df1<-read_excel('exam.xlsx')
names(df1)
[1] "HAART_reg" "Base_CD4" "CD4_at_12" "diabetes"
[5] "hypertension" "tuberculosis" "Base" "CD412"
我想使用变量Base
和CD412
制作交叉表,这些变量是级别为0
和1
的分类变量
library(expss)
cro(df1$Base,df1$CD412)
出现以下错误消息:
Error in name_dots(...) : could not find function "name_dots"
该如何解决?
答案 0 :(得分:2)
尝试devtools::install_github("gdemin/expss")
怎么样?
或者第二种选择是运行:
name_dots <- function(...) {
dot_sub <- as.list(substitute(list(...)))[-1L]
vnames = names(dot_sub)
if (is.null(vnames)) {
vnames = rep.int("", length(dot_sub))
novname = rep.int(TRUE, length(dot_sub))
} else {
vnames[is.na(vnames)] = ""
if (any(vnames==".SD")) stop("A column may not be called .SD. That has special meaning.")
novname = vnames==""
}
for (i in which(novname)) {
if ((tmp <- deparse(dot_sub[[i]])[1L]) == make.names(tmp))
vnames[i] = tmp
}
still_empty = vnames==""
if (any(still_empty)) vnames[still_empty] = paste0("V", which(still_empty))
list(vnames=vnames, novname=novname)
}
参考:https://github.com/Rdatatable/data.table/blob/master/R/utils.R