An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090414/be9872fa/attachment-0001.pl>
Subset function: selecting variables within a factor
3 messages · Thomas Lumley, Andrew McFadden
On Tue, 14 Apr 2009, Andrew McFadden wrote:
Hi all I know this must be an easy one so sorry for the trouble. I would like to select a list of variables within a factor The following example is given in help for subset: subset(airquality, Temp > 80 select = c(Ozone, Temp)) So how do I select all temperatures of 90 and 80 ie Temp = c(80,90)
subset(airquality, Temp %in% c(80,90))
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
Hey Thomas Thanks mate I knew there had to be an easy answer. Thanks for coming to my rescue. Regards Andrew McFadden MVS BVSc | Incursion Investigator (animals), Investigation and Diagnostic Centre | Biosecurity New Zealand Ministry of Agriculture and Forestry | 66 Ward St, Wallaceville | PO Box 40 742 | Upper Hutt | New Zealand Telephone: 64-4-894 5611 | Facsimile: 64-4-894 4973| Mobile: 027-733-1791 | Web: www.maf.govt.nz -----Original Message----- From: Thomas Lumley [mailto:tlumley at u.washington.edu] Sent: Tuesday, 14 April 2009 3:29 p.m. To: Andrew McFadden Cc: r-help at r-project.org Subject: [Requires Classification] Re: [R] Subset function: selecting variables within a factor
On Tue, 14 Apr 2009, Andrew McFadden wrote:
Hi all I know this must be an easy one so sorry for the trouble. I would like
to select a list of variables within a factor The following example is
given in help for subset: subset(airquality, Temp > 80 select = c(Ozone, Temp)) So how do I select all temperatures of 90 and 80 ie Temp = c(80,90)
subset(airquality, Temp %in% c(80,90))
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
########################################################################
This email message and any attachment(s) is intended solely for the
addressee(s) named above. The information it contains is confidential
and may be legally privileged. Unauthorised use of the message, or the
information it contains, may be unlawful. If you have received this
message by mistake please call the sender immediately on 64 4 8940100
or notify us by return email and erase the original message and
attachments. Thank you.
The Ministry of Agriculture and Forestry accepts no responsibility for
changes made to this email or to any attachments after transmission from
the office.
########################################################################