[R] For loop help

Rui Barradas ruipbarradas at sapo.pt
Wed Jul 11 23:48:10 CEST 2012


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