设置huxtable中的行高

huangapple go评论65阅读模式
英文:

Setting row height in huxtable

问题

I'm using the expss package to generate tables and then passing them to huxtable. This works fine but height function does not seem to work. Any insights? This occurs regardless of using a theme or exporting to HTML or Word.

t <- mpg %>%
  tab_cells(hwy, displ) %>%
  tab_rows(manufacturer) %>%
  tab_stat_mean() %>%
  tab_pivot() %>%
  set_caption("Car Stats") %>%
  as_huxtable() %>%
  set_col_width(1, .1) %>%
  theme_article()

height(t) <- 0.1   # if I change this to 0.2 I get the same result...

t
英文:

I'm using the expss package to generate tables and then passing them to huxtable This works fine but height function does not seem to work. Any insights? This occurs regardless of using a theme or exporting to HTML or Word.

t&lt;-mpg %&gt;% tab_cells(hwy,displ) %&gt;%
  tab_rows(manufacturer) %&gt;% 
  tab_stat_mean() %&gt;%
  tab_pivot() %&gt;% 
  set_caption(&quot;Car Stats&quot;) %&gt;% 
  as_huxtable() %&gt;% 
  set_col_width(1,.1)  %&gt;%
  theme_article()

height(t)&lt;-0.1   # if I change this to 0.2 I get the same result...

t

答案1

得分: 1

行高的最小值是1.0。要将行放置得更近,可以使用以下示例中的padding

mpg %>% tab_cells(hwy,displ) %>%
  tab_rows(manufacturer) %>%
  tab_stat_mean() %>%
  tab_pivot() %>%
  set_caption("Car Stats") %>%
  as_huxtable() %>%
  set_top_padding(.2) %>%
  set_bottom_padding(.2) %>%
  theme_article()
英文:

The row height minimum is 1.0. To place rows closer together, use padding as shown below:

mpg %&gt;% tab_cells(hwy,displ) %&gt;%
  tab_rows(manufacturer) %&gt;% 
  tab_stat_mean() %&gt;%
  tab_pivot() %&gt;% 
  set_caption(&quot;Car Stats&quot;) %&gt;% 
  as_huxtable() %&gt;% 
  set_top_padding(.2) %&gt;%
  set_bottom_padding(.2) %&gt;% 
  theme_article()

huangapple
  • 本文由 发表于 2023年4月20日 04:20:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76058523.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定