简体   繁体   English

在R中运行cro函数时如何解决错误?

[英]How to fix the error while running cro function in R?

df1<-read_excel('exam.xlsx')
names(df1)

[1] "HAART_reg"    "Base_CD4"     "CD4_at_12"    "diabetes"    
[5] "hypertension" "tuberculosis" "Base"         "CD412"

I want to make a cross table using the variables Base and CD412 which are categorical variables with levels 0 and 1 我想使用变量BaseCD412制作交叉表,这些变量是级别为01分类变量

library(expss)

cro(df1$Base,df1$CD412)

The following error message appears: 出现以下错误信息:

Error in name_dots(...) : could not find function "name_dots"

How to fix this? 如何解决这个问题?

How about trying devtools::install_github("gdemin/expss") ? 尝试devtools::install_github("gdemin/expss")怎么样?

Or the second option is to run: 或者第二种选择是运行:

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)
}

Reference: https://github.com/Rdatatable/data.table/blob/master/R/utils.R 参考: https : //github.com/Rdatatable/data.table/blob/master/R/utils.R

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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