[R] read.table and factor

Bill Simpson wsi at gcal.ac.uk
Mon Feb 21 11:15:47 CET 2000


I have a data file like this:

std     cf      hit     miss    fa      cr
920     980     40      15      14      31
950     1010    24      23      23      30
1190    1250    26      21      27      26
1010    1070    33      10      28      29
1040    1100    35      10      11      44

I use read.table to read it in. My problem is that read.table makes std
and cf into factors. I want them just to be ordinary numeric variables.

as.numeric(d$std) doesn't work properly (as the docs warn), and same goes
for codes(d$std)

How can I either tell read.table to leave the first two cols as numeric
(not factors) or convert them from factors into the proper numeric values?

Thanks very much for any help.

Bill Simpson

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list