0
我想总结下面的数据框,但我一直拿NA,而不是我期待的意思。有人可以解释为什么会这样吗?dplyr值汇总返回不适用
fbobjective<-data.frame(
Participant=c("a","c","c"),
"Part.2.or.3."=c(3,2,2),
No_Photos=c(10,12,40)
)
fb_obj_v2<-fbobjective
#unique participant id's
fb_obj_v2$Participant<-paste0(fb_obj_v2$Participant,fb_obj_v2$"Part.2.or.3.")
fb_obj_v2$"Part.2.or.3."<-NULL
dim(fb_obj_v2)
#convert numbers to numbers or NA. bind Participant names back to this
numeric_results<-as.matrix(sapply(fb_obj_v2, as.numeric))
numeric_results<-as.data.frame(numeric_results)
numeric_results[,1]<-fb_obj_v2$Participant
numeric_results<-as.data.frame(numeric_results)
View(numeric_results)
#return data
res<-numeric_results %>% group_by(Participant) %>% summarise(mean("No_Photos"))
View(res)