I'm trying to group together chimp and human brain samples by renaming them. There are 24 samples total, the first 12 are chimp, the last are human. It repeats by brain area 3 times (3 different chimp/human samples of 4 different brain regions). I have been able to produce all 24 sample names, but they were not in the correct order. It should be CHPrefrontal,CHCaudate,CHCerebellum, CHBroca then repeat those for 2 more times, then same setup for the human samples. Any suggestions? This is what I have so far:
trts=paste(rep(c("CHPrefrontal","CHCaudate","CHCerebellum","CHBroca","HUPre frontal","HUCaudate","HUCerebellum","HUBroca"),each=3),rep(c(1:3, 1:3, times=3)),sep="")
paste(trts)
The output is:
[1] "CHPrefrontal1" "CHPrefrontal2" "CHPrefrontal3"
[4] "CHCaudate1" "CHCaudate2" "CHCaudate3"
[7] "CHCerebellum3" "CHCerebellum1" "CHCerebellum2"
[10] "CHBroca3" "CHBroca1" "CHBroca2"
[13] "HUPrefrontal3" "HUPrefrontal3" "HUPrefrontal1"
[16] "HUCaudate2" "HUCaudate3" "HUCaudate1"
[19] "HUCerebellum2" "HUCerebellum3" "HUCerebellum3"
[22] "HUBroca1" "HUBroca2" "HUBroca3"