See
?read.csv
and read the part about colClasses.
> X <- read.csv(textConnection("x1 ,x2,x3
+ 10,20,30
+ 11 ,22,35"), colClasses = c("character", "character", "numeric")
+ )
> str(X)
'data.frame': 2 obs. of 3 variables:
$ x1: chr "10" "11 "
$ x2: chr "20" "22"
$ x3: num 30 35
>
-Ista
Hi:
If I want to read a file with read.table. I want x1 and x2 to be read as
character and x3 as numeric. How to do this? Thanks.
Satish
x1 ,x2,x3
10,20,30
11 ,22,35
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLE
2 matches
Mail list logo