简体   繁体   中英

Error in group_rows(“SUCK”, 2, 3) : unused arguments (“SUCK”, 2, 3) in Kable

I have a problem with $\\texttt{group_rows}$ when using $\\texttt{kable()}$.

I did not have this problem before. I closed my .rmd file for one day and opened it this morning. Now, it cannot be knitted. I do not know what is going on. Everything works perfectly before I updated my packages in R.

data<- read.table("http://www.stat.umn.edu/~gary/book/fcdae.data/pr12.6",header=TRUE)
attach(data)

Lab.1 <- data[data$lab == 1, ]
Lab.2 <- data[data$lab == 2, ]
Lab.3 <- data[data$lab == 3, ]
Lab.4 <- data[data$lab == 4, ]
Lab.5 <- data[data$lab == 5, ]


Lab1.mat <- matrix(Lab.1$count, ncol = 8, nrow = 2, byrow = TRUE)
Lab2.mat <- matrix(Lab.2$count, ncol = 8, nrow = 2, byrow = TRUE)
Lab3.mat <- matrix(Lab.3$count, ncol = 8, nrow = 2, byrow = TRUE)
Lab4.mat <- matrix(Lab.4$count, ncol = 8, nrow = 2, byrow = TRUE)
Lab5.mat <- matrix(Lab.5$count, ncol = 8, nrow = 2, byrow = TRUE)

m1 <- merge(Lab1.mat,Lab2.mat, all=T,sort = FALSE)
m2 <- merge(Lab3.mat,Lab4.mat, all=T,sort = FALSE)
m3 <- merge(m1,m2,all=T,sort = FALSE)
m <- merge(m3,Lab5.mat,all=T,sort = FALSE)
colnames(m)<- NULL

kable(m,"latex", booktabs = T) %>%
  kable_styling() %>%
  group_rows("SUCK",1,2)

Any tip would be appreciated. Thanks!

Have you tried to add kableExtra:: before group_rows ? I met the same problem and this seems to work for me

kable(m,"latex", booktabs = T) %>%
  kable_styling() %>%
  kableExtra::group_rows("SUCK",1,2) # add kableExtra:: here

I think the reason is that there is another group_rows function in dplyr . When you load kableExtra , it will automatically load dplyr for you so you need to specify the package you are using for this function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM