[R] convertin a data frame column from character to numeric

From: joseph <jdsandjd_at_yahoo.com>
Date: Fri, 8 Feb 2008 09:06:21 -0800 (PST)

I have a data.frame with all character columns, I would like to convert the last two columns into numeric.> x[1:5, ]   chrN    start      end                             1  chr1 71310034 71310064     2 chr14 23354088 23354118     3 chr14 71310034 71310064 4 chr15 37759058 37759088 
5 chr22 18262638 18262668 > apply(x, 2, FUN =  mode)    chrN       start         end        "character" "character" "character" 

Be a better friend, newshound, and

        [[alternative HTML version deleted]]

R-help_at_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. Received on Fri 08 Feb 2008 - 17:10:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Feb 2008 - 18:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive