[R] How do I coerce numeric factor columns of data frame to vector?

Michael A. Miller mmiller3 at iupui.edu
Tue Sep 9 19:25:46 CEST 2003


>>>>> "Na" == Na Li <nali at biostat.umn.edu> writes:

    > x <- c(1, 3, 1) 
    > y <- factor (x) 
    > y
    > [1] 1 3 1 
    > Levels: 1 3
    > as.numeric (y)
    > [1] 1 2 1

Ah, now I get it - thanks!

Mike




More information about the R-help mailing list