Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
试图从函数中调用 Expss。但是它返回一个空表。
s1_a<-c("a","b","b") s1_b<-c("a","a","b") df<-data.frame(s1_a,s1_b) multi<-function(v) { df %>% tab_cells(mrset_p("v")) %>% tab_stat_cpct() %>% tab_sort_desc() %>% tab_pivot() } multi("s1_")
在您的情况下,您不需要引号mrset_p:
mrset_p
library(expss) s1_a<-c("a","b","b") s1_b<-c("a","a","b") df<-data.frame(s1_a,s1_b) multi<-function(v) { df %>% tab_cells(mrset_p(v)) %>% # no quotes tab_stat_cpct() %>% tab_sort_desc() %>% tab_pivot() } multi("s1_")