[R] selecting only specific rows in R

stephen sefick ssefick at gmail.com
Sat Jun 5 19:00:37 CEST 2010


Reproducible dummy example, as to the posting guide.  look at unique-
you want to subset the data frame on all of the non-unique entries in
the species column...

x[x!=unique(x[,"species"]),]

Something like that, maybe.  If I had some data then I could probably
figure it out.  Use dput() or fake data to make a cut and paste-able
example.
HTH,

Stephen

On Sat, Jun 5, 2010 at 10:00 AM, Adrienne Keller
<adrienne.keller at umontana.edu> wrote:
> Hi, I have a data frame with columns as follows: tree species (independent
> variable) and several dependent variables (e.g. carbon, nitrogen,
> phosphorus). Each row represents one tree sample. Some tree samples are
> unique species in the data frame while other species were replicated (i.e.
> rows 1,2,3 may be identical for the "tree species" column but have different
> values for the other dependent variable columns). I want to create a new
> data frame that selects only the tree species that have replicates. In other
> words, I want to select all rows that have at least one replicate in the
> column "tree species".
>
> Ideas on how to write such a function?
>
> Thanks,
>
> Adrienne Keller
>
> ______________________________________________
> 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.
>



-- 
Stephen Sefick
____________________________________
| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___________________________________|
| sas0025 at auburn.edu                             |
| http://www.auburn.edu/~sas0025             |
|___________________________________|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis



More information about the R-help mailing list