Skip to content

For loop help

3 messages · cs389, Yasir, Rui Barradas

#
Hi Everyone,
   I could use help developing a for loop. I have a dataset with tallies for
a number of species within 7 different size classes. I need to uncollate the
data into the rawest form (ie: each row a different individual) & retrain
the metadata associated with each row (Date, Recorder, Site, Transect and
Species). Here is an example of the current format:

http://r.789695.n4.nabble.com/file/n4636155/data.jpg 
  




Could someone help me write a for loop? I am looking for something like this
(represents just the top 2 rows of the first table):

Date  Recorder  Site Transect  SpeciesSize Class
7/6/10	CSC	Puako	A	MOCA	5-10cm
7/6/10	CSC	Puako	A	MOCA	5-10cm
7/6/10	CSC	Puako	A	MOCA	20-40cm
7/6/10	CSC	Puako	A	MOPA	<5cm
7/6/10	CSC	Puako	A	MOPA	<5cm
7/6/10	CSC	Puako	A	MOPA	5-10cm
7/6/10	CSC	Puako	A	MOPA	10-20cm





Many Thanks!
Courtney

--
View this message in context: http://r.789695.n4.nabble.com/For-loop-help-tp4636155.html
Sent from the R help mailing list archive at Nabble.com.
#
Hello,

Please don't post datasets like this, it's unusable by us. Use dput().

?dput
dput(head(myData, 20))  # post the output of this.


Paste the output of that command in a post. It starts with 'structure'. 
Don't worry if it looks awkward, it is, on the contrary, very usefull. 
All we need to do s to paste it n an R session to have an exact copy of 
your data, dat <- structure(...etc...).

Hope this helps,

Rui Barradas

Em 11-07-2012 19:10, cs389 escreveu: