我试图把我的代码,它运行完美,在一个R标记,但我不断得到row_to_name错误,当我编织,但没有当我运行块。老实说,我不知道该怎么修理它。
代码:
homicidios<-read.csv("/Users/julia/Documents/rdoctorado/tasa estatal homicidios.csv",header = TRUE)
#Transform the vector to data frame
thomicidios<-data.frame(homicidios)
# transpose the matrix To compute stats
th<-t(homicidios)
#delete first row and set it as header
thomicidios<-row_to_names(th,1,remove_row = TRUE)
#Transform the vector to data frame
thomicidios2<-data.frame(thomicidios)
#Convert string to integer
thomicidios2[c(1:33)] <- lapply(thomicidios2[c(1:33)], as.integer)
#Summary of the data
summary(thomicidios2)
错误是:
row_to_names(th, 1, remove_row = TRUE)错误:找不到函数"row_to_names";电话:…处理→withCallingHandlers→withVisible→eval→eval
我认为您需要在"this"中添加library(janitor)
。代码块。