簡體   English   中英

如何在 kable() 中設置列​​寬?

[英]How to set column width in kable()?

我有一個要為 HTML 報告顯示的數據表。 她是一張假桌

BelQ= structure(list(Source = "Kalender 2019", `Sourse of Questions` = "The survey instruments were part of a larger survey that included other motivational constructs. The development and validation of these surveys is reported in prior work [18–22,59]. ",     Results = "PCA analysis reveals that for both genders, sense of belonging and identity were not separate from the Expectancy Value Theory constructs. Instead, sense of belonging was closely tied to self-efficacy, which was therefore labeled as “self-efficacy or belonging” component or factor. ", Questions = "Sense of Belonging or Self-efficacy (not separated in a paper):<br>1. Sometimes I worry that I do not belong in this physics class<br>2. I feel like I can be myself in this class<br>3. I am able to help my classmates with physics in the laboratory or in recitation<br>4. I understand concepts I have studied in physics<br>5. If I wanted to, I could be good at physics research<br>6. ",     Reference = "Kalender, Z. Y., Marshman, E., Schunn, C. D., Nokes-Malach, T. J., & Singh, C. (2019). Gendered patterns in the construction of physics identity from motivational factors. Physical Review Physics Education Research, 15(2), [020119](https://journals.aps.org/prper/abstract/10.1103/PhysRevPhysEducRes.15.020119)"), row.names = c(NA, -1L), class = c("tbl_df", "tbl", "data.frame"))

當我嘗試生成表格時,我無法更改列的寬度,並且在 UseMethod("nodeset_apply") 中出現錯誤錯誤:“nodeset_apply”沒有適用的方法應用於“NULL”類的對象

BelQ  %>%
  kable(format = "html",escape = FALSE) %>%   kable_styling() %>% 
  scroll_box(width = "100%", height = "500px") %>% 
  kable_styling(full_width = F) %>%
  column_spec(1, width = "18em")

我的代碼塊有{r results="asis" }

不知道為什么,但是scroll_box應該放在最后, width_min要使用width_min

BelQ  %>%
  kable(format = "html",escape = FALSE) %>%   
  kable_styling(full_width = F) %>% 
  column_spec(1, width_min = "18em")%>%
  scroll_box(width = "100%", height = "500px") 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM