我正在尝试构建一个由三个字符变量和一个数字变量组成的数据框。当我运行以下代码时,我得到一个四列矩阵,但分数变量不再是数字,分数被视为因素。
school<-c("NYU", "BYU", "USC", "FIT", "UNH","UCLA","USF","Columbia")
state<-c("NY","UT","CA","NY","NY","CA", "CA","NY")
measure<-c("MSAT","MSAT","GPA","MSAT","MSAT","GPA","GPA","GPA")
score<-c(500, 490, 2.9, 759, 550, 1.2, 3.1, 3.2)
data<-cbind(school,state, measure,score)
如果我跑
data1<-data.frame(cbind(school,state, measure,score))
我得到一个score
仍然是一个因素的数据框。我怎样才能建立这个数据框,以便它score
是数字的?