Skip to content
Prev 164740 / 398506 Next

how to convert factors to numbers

On 14/12/2008 12:38 PM, doloop wrote:
Notice the commas:  they are being read as part of the data, not as 
separators.  I imagine you need to use read.csv, not read.table, or 
specify sep="," to the latter.

Once you're reading the data properly, you can convert to a number using 
as.numeric(as.character( f )), where f is the factor.  Don't just use 
as.numeric(f); that will just extract the internal encoding.

Duncan Murdoch