[R] re ad.table
Simon Pickett
simon.pickett at bto.org
Fri Dec 19 14:29:47 CET 2008
probably best just to change each variable one by one to the correct
classification after you have read the data frame in.
variable<-as.character(variable)
----- Original Message -----
From: "threshold" <r.kozarski at gmail.com>
To: <r-help at r-project.org>
Sent: Friday, December 19, 2008 12:35 PM
Subject: [R] re ad.table
>
> Hi , I want to use the read.table to the following example 'data.txt'
> format:
> a b c d e f
> SPX LSZ 100 C 0 34.4
> SPX LSZ 100 P 0 1.3
> SPX LSZ 105 C 0 30.3
> SPX LSZ 105 P 0 1.85
> SPX LSZ 110 C 0 26.4
>
> and I want to have the columns a,b,d read as the 'character' data, a the
> remaining columns as 'numeric'. What I did was:
> read.table("data.txt",header=T,
> colClasses=c("character","character","numeric","character",
> "numeric","numeric"), but I could not get what I want, since all values
> were
> in the 'character' format. I will apprecaite any suggestions.
> best, robert
> --
> View this message in context:
> http://www.nabble.com/read.table-tp21090550p21090550.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list