I'm sorry everyone for the inconvenience of spamming the R-help... Here's the complete post:
Hi everyone, > > Since it's quite a while that I used the reshape package, I now feel kind > of rusty. > > I have a data.frame like this: > > > > id Sample.Name Marker Allele.1 > Allele.2 sample_id species > 1 01_primer01 Dalb01 165 > 179 SH233 D. madagascariensis > 2 01_primer04 Dalb04 221 > 225 SH233 D. madagascariensis > 3 01_primer08 Dalb08 218 > 218 SH233 D. madagascariensis > 4 01_primer10 Dalb10 134 > 134 SH233 D. madagascariensis > 5 01_primer14 Dalb14 250 > 250 SH233 D. madagascariensis > 6 01_primer16 Dalb16 232 > 232 SH233 D. madagascariensis > > this was just the head(), in fact, the sample_id col has in fact different > ids, I would like to aggregate them into one > and I would like to get something like this: > > species sample_id Marker1_Allele1 > Marker1_Allele2 Marker2_Allele1 Marker2_Allele2 > Marker3_Allele1 Marker3_Allele2 etc. (with 35 > different markers) > > D. madagascariensis SH233 179 > 225 134 > 244 > > I tried to prepare the cast() but didn't quite figure out how to achieve > this. I wanted to create a col with the MarkerX_AlleleY 's, but didn't find > any useful solutions. The sample_id's should be aggregated so that each > sample_id needs just one row. Should I just merge columns Allele.1, > Allele.2 and sample_id? > I'm kind of stuck, but would appreciate any help on the columns to be merged. Thanks a lot Martin Schilling > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.