R – Convert Factor columns in data frame to numeric type columns

r

Possible Duplicates:
Convert factor to integer
R – How to convert a factor to an integer\numeric in R without a loss of information

I have read a text file where some of the columns with real number are read as factors into a data frame. How do i convert the factoe columns into numeric columns

Best Solution

You can use

as.numeric(as.character(x))