Re: [R] Randomizing a dataframe

2009-07-10 Thread Mark Na
Greg's reply was just what I needed to get me going. I used his advice to produce a program which does just what I need. In case it helps someone else, my program is below. Mark Na library(reshape) data<-read.csv("data.csv") datam<-melt(data,id=("TREE")) #value = number of individuals datam<-da

Re: [R] Randomizing a dataframe

2009-07-08 Thread Greg Snow
Here is one approach (there are others, some that are probably better, but this can get you started): 1. rearrange your data so that every insect is a single row with 2 columns: the tree id and the species (this new dataset will have as many rows as the sum of the values in the old dataset). T

Re: [R] Randomizing a dataframe

2009-07-08 Thread Mark Knecht
On Wed, Jul 8, 2009 at 8:54 AM, Mark Na wrote: > Hi R-helpers, > > I have a dataframe (called data) with trees in rows (n=100) and insect > species (n=10) in columns. My tree IDs are in a column called TREE and each > species has a column labeled SPEC1, SPEC2, SPEC3, etc... > > I wish to randomize