[R] How to filter information from a table into a new table
Mulholland, Tom
Tom.Mulholland at dpi.wa.gov.au
Thu Jan 20 02:06:58 CET 2005
temp <- table(rpois(100,5),rpois(100,1))
temp
temp[temp[,1] > 1,]
temp[temp[,1] == 1,]
temp[temp[,1] == 2,]
temp[temp[,1] == 3,]
Of course you have not made it obvious if you are using the term table to mean any output that looks like a table, but in general terms you will find information in the documentation that comes with R, such as "An Introduction to R."
In your case
anything.you.like <- T[T[,1] == 1,]
Tom
> -----Original Message-----
> From: K Fernandes [mailto:kafernan at uwaterloo.ca]
> Sent: Thursday, 20 January 2005 7:15 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] How to filter information from a table into a new table
>
>
> Hello,
>
>
>
> Say I have a table T as follows
>
>
>
> A b
>
> 1 2
>
> 1 3
>
> 2 2
>
> 2 3
>
> ...etc.
>
>
>
> And I would like create a table C from this existing table T, but only
> including rows where A=1.
>
>
>
> How might I do this?
>
>
>
> Thanks,
>
>
>
> K - please reply to kafernan at uwaterloo.ca as well as I am on
> the digest
> version :)
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
>
More information about the R-help
mailing list