Yes, just set the colClasses argument to read.table (this will also tend to speed up the reading, though only noticeable for really big files).
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Erin Hodgess > Sent: Wednesday, December 08, 2010 12:40 PM > To: R help > Subject: [R] read.table and factors > > Dear R People: > > Suppose I have the following in a file: > > 1 1.171504 1.010070 > 2 -0.9317064 1.860900 > 3 -0.06522837 0.6561147 > 4 -1.817026 0.02619137 > 5 1.426983 0.5995691 > 6 -0.2844911 1.155561 > 7 -0.6920972 0.7633124 > 8 0.3129615 5.121108 > > I want to use read.table to bring it in and I want the first column to > be a factor. Is there a way to set up read.table such that the first > column is a factor and the others are numeric, please? > > Thanks, > Erin > > > -- > Erin Hodgess > Associate Professor > Department of Computer and Mathematical Sciences > University of Houston - Downtown > mailto: erinm.hodg...@gmail.com > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.