[R] Selecting particular rows in a table

Joshua Wiley jwiley.psych at gmail.com
Mon Feb 14 08:00:42 CET 2011


Hi,

Well, how did you make that little 10 row sample for us?  The same
subsetting principles hold in R regardless of hugeness.  I am kind of
assuming you have a matrix or data frame class object, in which case,
here is a little example for you:

## Big matrix
dat <- matrix(1L, nrow = 134000, ncol = 4)
## somewhat smaller matrix
dat2 <- dat[60000:90000, ]


## Show the objects' dimensions
dim(dat)
dim(dat2)

## show their size
object.size(dat)
object.size(dat2)

## For documentation see
?"["

Cheers,

Josh

On Sun, Feb 13, 2011 at 10:01 PM, kparamas <kparamas at asu.edu> wrote:
>
> Hi,
>
> I have a huge table with 134,000 entries. I want to choose only rows 60,000
> to 90,000.
> Please help me on how to do this.
>
>         V1       V2 V3  V4
> 1  31.10267 168.3204 41 0.4
> 2  31.19941 168.1488 41 0.4
> 3  31.29580 167.9764 41 0.4
> 4  31.39183 167.8034 41 0.4
> 5  31.48750 167.6297 41 0.4
> 6  31.58280 167.4553 41 0.4
> 7  31.67774 167.2803 41 0.4
> 8  31.77229 167.1045 41 0.4
> 9  31.86648 166.9281 41 0.4
> 10 31.96028 166.7510 41 0.4
> ....
> --
> View this message in context: http://r.789695.n4.nabble.com/Selecting-particular-rows-in-a-table-tp3304488p3304488.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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list