R Kables不是';看不到我的kable_造型属性?

R Kables不是';看不到我的kable_造型属性?,r,knitr,kable,R,Knitr,Kable,我试图用knitr::kables吐出两个 不过,我不知道如何让我的风格保持下去。如果我运行一个kable,则样式工作正常: kable( caption = "Oh look! A Caption", starwars %>% count(gender, sex) %>% arrange(desc(gender)) ) %>% kable_styling(bootstrap_o

我试图用
knitr::kables
吐出两个

不过,我不知道如何让我的风格保持下去。如果我运行一个kable,则样式工作正常:

 kable(
      caption = "Oh look! A Caption",
      starwars %>%
        count(gender, sex) %>%
        arrange(desc(gender)) 
    ) %>%
      kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
给我一张整洁的桌子:

但是如果我试图同时设置两个,格式(或
kable_样式
)就会丢失:

knitr::kables(list(
   kable(caption = "Oh look! A Caption",
         starwars %>%
           count(gender, sex) %>%
           arrange(desc(gender))) %>%
     kable_styling(bootstrap_options = c("striped", "hover", "condensed")),
   
   
   kable(caption = "Oh look! A Caption",
         starwars %>%
           count(gender, sex) %>%
           arrange(desc(gender))) %>%
     kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
 ))
格式设置全部消失:


如何将
kable\u样式设置应用于两个
kable

非常令人不满意的解决方案是添加第三个
kable\u样式设置()
调用:

knitr::kables(list(
  kable(caption = "Species",
    starwars %>%
      count(species) %>%
      filter(n > 1)
    ) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed")),
    kable(caption = "Homeworld",
      starwars %>%
        count(homeworld) %>%
        filter(n > 1)
    ) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
    
  )
) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed"))

这看起来很冗长,但它确实有效。

非常令人不满意的解决方案是添加第三个
kable\u styleing()
调用:

knitr::kables(list(
  kable(caption = "Species",
    starwars %>%
      count(species) %>%
      filter(n > 1)
    ) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed")),
    kable(caption = "Homeworld",
      starwars %>%
        count(homeworld) %>%
        filter(n > 1)
    ) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
    
  )
) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
这似乎很冗长,但它确实有效