Sorry, I'm sure I'm not using the appropriate vocab here, which is
undoubtedly why I can't seem to find a fix to this (hopefully very
easy) problem.

Suppose you have a factor

abc <- factor(c(2,2,3,4,7,7))

And you want to know what the number in the nth spot in that would be

abc[1]
[1] 2
Levels: 2 3 4 7

shows the correct label of the first element - but if I want to pull
out the numeric value of that label, I thought...

as.numeric(abc[1])

but that gives
[1] 1

which is the position of the label in the levels vector of the factor.

Ideas?

Thanks!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to