>>>>> "Gabor" == Gabor Grothendieck <[EMAIL PROTECTED]>
>>>>>     on Mon, 3 Jul 2006 16:58:14 -0400 writes:

    Gabor> Try this:

    Gabor> # test data
    Gabor> # read in header separately so R does not make column names unique

    Gabor> Lines <- "AAA BBB CCC DDD AAA BBB
    Gabor> 0      2      1     2      0      0
    Gabor> 2      3      7     6      0      1
    Gabor> 1.5    4      9     9      6      0
    Gabor> 1.0    6      10    11     3      3
    Gabor> "
    Gabor> DF <- read.table(textConnection(Lines), skip = 1)
    Gabor> names(DF) <- scan(textConnection(Lines), what = "", nlines = 1)

Hmm, this is unnecessarily slightly complicated.
Instead, rather make use of read.table()'s capabilities, by

   DF <- read.table(textConnection(Lines), check.names=FALSE, header=TRUE)
   ##                                      ^^^^^^^^^^^^^^^^^

Martin Maechler, ETH Zurich

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to