[R] colClasses

Duncan Murdoch murdoch at stats.uwo.ca
Mon Oct 11 22:26:25 CEST 2004


On Mon, 11 Oct 2004 16:21:31 -0400, "Kalaylioglu, Zeynep (IMS)"
<KalayliogluZ at imsweb.com> wrote:

>Hi
>I am trying to read a data frame from a text editor in to R. I want some
>of the columns to be read in as "character" not numeric.
>I figured that I can do that by using "colClasses" in  "read.table"
>command. However, I couldn't find out how to use 
>"colClasses". e.g. say I have 5 column in the data file. I want 1st and
>3rd column to be read in as character. How can I define
>this using colClasses?  (or is there a better way to do what I want?)

The help page for read.table looks reasonably clear to me.  Wouldn't
colClasses = c('character', 'numeric', 'character', 'numeric',
'numeric')

work?

Duncan Murdoch




More information about the R-help mailing list