Try this:

> reshape(x, idvar=c('Name','Block'), timevar='Slide',direction='wide')
     Block            Name pearson_res.23 pearson_res.24 pearson_res.30
2102     2 CTERQANFLGKIWPS     0.07618407    -0.10250513    -0.01064459
2103     2 ATLEEMMTACQGVGG     1.93543619    -0.05479617    -0.03758618
2104     2 IPVGEIYKRWIILGL     0.22211959     0.14669877     0.20724517
2105     2 MFSALSEGATPQDLN    -0.08249410    -0.19059432    -0.23034595
>



On 12/10/06, Jenny persson <jenny197806@yahoo.se> wrote:
>
> Dear all,
>
> I have a dataset
>
>
> dat<- pep[c(420:423,1258:1261,2096:2099),c(3,4,7,14)]
>
>
>       Slide  Block       Name     pearson_res
> 2102    23     2 CTERQANFLGKIWPS  0.07618407
> 2103    23     2 ATLEEMMTACQGVGG  1.93543619
> 2104    23     2 IPVGEIYKRWIILGL  0.22211959
> 2105    23     2 MFSALSEGATPQDLN -0.08249410
> 3662    24     2 CTERQANFLGKIWPS -0.10250513
> 3663    24     2 ATLEEMMTACQGVGG -0.05479617
> 3664    24     2 IPVGEIYKRWIILGL  0.14669877
> 3665    24     2 MFSALSEGATPQDLN -0.19059432
> 6782    30     2 CTERQANFLGKIWPS -0.01064459
> 6783    30     2 ATLEEMMTACQGVGG -0.03758618
> 6784    30     2 IPVGEIYKRWIILGL  0.20724517
> 6785    30     2 MFSALSEGATPQDLN -0.23034595
>
>
> where all slides (23,24,30) have the same name. I want to rearrange the
> dataset so it will have the matrix look
>
>          Name    slide=23 slide=24 slide=30 block
> CTERQANFLGKIWPS
> ATLEEMMTACQGVGG
> IPVGEIYKRWIILGL
> MFSALSEGATPQDLN
>
> the pearson_res values will be filled under each slide corresponding to
> the name-variable.
>
> I find manipulating data like this is quite tricky. Thanks for your help.
>
> Bests,
> Jenny
>
>
>
>
> ---------------------------------
>
> Stava rätt! Stava lätt! Yahoo! Mails stavkontroll tar hand om tryckfelen
> och mycket mer! Få den på http://se.mail.yahoo.com
>        [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>
>
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]


