3.2.4更新2016-03-10
我试图在一个大数据集中重命名列,并运行到“from值不存在于x中:”错误。
从原始导出的列是可怕的,这就是为什么我使用plyr重命名,但似乎连重命名都有问题。示例故障列是,3在链接数据集中,标题为:
"Experimental.or.quasi.experimental..evaluation..compares.mentored.youth.to.a.comparison.or.â.œcontrolâ...group.of.non.mentored.youth..NS8“
下载到csv 这里的链接:下面的代码:
test<-read.csv(file="test.csv",header=TRUE)
library(plyr)
test2<-rename(test,
c(
"Experimental.or.quasi.experimental..evaluation..compares.mentored.youth.to.a.comparison.or.â.œcontrolâ...group.of.non.mentored.youth..NS8"="new"))发布于 2016-03-17 19:12:03
试着使用setNames来代替:
library(plyr)
test2 <- rename(test, setNames( "new", names(test[3])))
names(test2)
[1] "Implementation.evaluation..examines.how.well.or.efficiently.services.were.delivered.to.participants..such.as.tracking.mentor.mentee.meetings..participation.in.trainings..etc....NS8"
[2] "Outcome.evaluation..examines.changes.in.participants.served.using.pre.post.data.collection..NS8"
[3] "new"
[4] "Return.on.investment.study..examines.long.term.impacts.from.an.economic.perspective..often.in.relation.to.program.costs..NS8" https://stackoverflow.com/questions/36068960
复制相似问题