R Question. Numeric variable vs. Non-numeric and "names" function
Posted
by Michael
on Stack Overflow
See other posts from Stack Overflow
or by Michael
Published on 2010-05-19T01:34:21Z
Indexed on
2010/05/19
1:40 UTC
Read the original article
Hit count: 285
> scores=cbind(UNCA.score, A.score, B.score, U.m.A, U.m.B)
> names(scores)=c('UNCA.scores', 'A.scores', 'B.scores','UNCA.minus.A', 'UNCA.minus.B')
> names(scores)
[1] "UNCA.scores" "A.scores" "B.scores" "UNCA.minus.A" "UNCA.minus.B"
> summary(UNCA.scores)
X6.69230769230769
Min. : 4.154
1st Qu.: 7.333
Median : 8.308
Mean : 8.451
3rd Qu.: 9.538
Max. :12.000
> is.numeric(UNCA.scores)
[1] FALSE
> is.numeric(scores[,1])
[1] TRUE
My question is, what is the difference between UNCA.scores and scores[,1]? UNCA.scores is the first column in the data.frame 'scores', but they are not the same thing, since one is numeric and the other isn't.
If UNCA.scores is just a label here how can I make it be equivalent to 'scores[,1]?
Thanks!
© Stack Overflow or respective owner