[R] rownumber

From: Ethan Johnsons <ethan.johnsons_at_gmail.com>
Date: Sun 10 Sep 2006 - 18:48:21 GMT


# R 2.3.1

I read the data set into R, but the data set have two rows per record.

i.e.

.........

105     1       1       1103    1       5       4       8       5       22
105     2       2       2       2       1       2       17      16      26
106     1       2       606     1       5       12      11      9       37
106     2       2       2       2       2       2       16      14      29
107     1       3       611     1       7       9       10      7       33
107     2       2       2       2       2       2       10      13      29
...........

How do you extract the certain columns on the first row set of each?

Tthe first row set are like:

105     1       1       1103    1       5       4       8       5       22
106     1       2       606     1       5       12      11      9       37
107     1       3       611     1       7       9       10      7       33

so, nothing gets imported from the second row set.

105     2       2       2       2       1       2       17      16      26
106     2       2       2       2       2       2       16      14      29
107     2       2       2       2       2       2       10      13      29
I tried:

> a <- subset(lead.dat, rownumber==1)

Error in eval(expr, envir, enclos) : object "rownumber" not found

> b <- subset(lead.dat, rownumber==2)

Error in eval(expr, envir, enclos) : object "rownumber" not found

What is wrong with this?
thx much

        [[alternative HTML version deleted]]



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 and provide commented, minimal, self-contained, reproducible code. Received on Mon Sep 11 05:59:06 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 10 Sep 2006 - 21:30:04 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.