[R] Simple question about extracting a subset of data

rmailbox at justemail.net rmailbox at justemail.net
Mon Sep 29 21:59:19 CEST 2008


It's hard to read your table, but I think this could be your problem:
daylength = "long.day"  is always TRUE
Testing for equality uses "==" so
daylength == "long.day" may or may not always be TRUE
 

----- Original message -----
From: "Josh B" <joshb41 at yahoo.com>
To: "R Help" <r-help at r-project.org>
Date: Mon, 29 Sep 2008 12:54:59 -0700 (PDT)
Subject: [R] Simple question about extracting a subset of data

Hello all,

I have a (hopefully) simple question.

If I have a data table (named "x") such as this:

daylengthleavesflowering.datefruits
LD1.90055581.64353250.76668986
LD-0.9399410-1.2592968-0.60141837
LD1.0222946-0.9697459 -0.60141837
SD-0.2668132-0.9697459-0.47363322
SD -1.5892393-0.70540660.66469785
SD -0.5222961-0.7054066-0.10701187

How do create a new data table that contains, e.g., only the long-day plants?

I have tried to do this using the "subset" command, but it seems to ignore me:

x.sd <- subset(x, daylength = "long.day", select = root.weight:stem.diameter)

This returns exactly the same data table I had before (including both long and short day plants).

So how do I do this properly? Actual code would be of the most direct help to me, since I am new at this. Thank you very much!


      
	[[alternative HTML version deleted]]

______________________________________________
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.



More information about the R-help mailing list