RE: [R] read.delim: only first column import

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Sat 16 Apr 2005 - 00:25:31 EST


You can use colClasses; e.g.,

> write.table(iris, file="iris.dat", sep="|", quote=FALSE, row=FALSE)
> test <- read.delim("iris.dat", sep="|", header=TRUE,
> colClass=c("numeric", rep("NULL", 4)))
> head(test)

  Sepal.Length

1          5.1
2          4.9
3          4.7
4          4.6
5          5.0
6          5.4


Andy

> From: Christoph Lehmann
>
> Hi
> if I use read.delim, I can specify how many lines I want to import.
> Is there also a way to specify that, e.g. I want only the
> first column
> field of each line to have imported?
>
> thanks for a hint
> cheers
> christoph
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Apr 16 01:00:19 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:11 EST