Hello, I have a general formatting question. I have two columns of data: ColA <- c("m", "m", "m", "m") ColB<- c("d","d","d","d") And I would like to reorder them into a new column that looks like this: ColC<- c("m","d","m","d","m","d","m","d") Thank you! Stephanie ________________________________ PHRI DISCLAIMER This information is directed in confidence solely to the person named above and may not otherwise be distributed, copied or disclosed. Therefore, this information should be considered strictly confidential. If you have received this email in error, please notify the sender immediately via a return email for further direction. Thank you for your assistance. [[alternative HTML version deleted]]
Try this: c(rbind(ColA, ColB)) On Thu, Dec 9, 2010 at 3:30 PM, Ross, Stephanie <Stephanie.Ross@phri.ca>wrote:> Hello, > > I have a general formatting question. I have two columns of data: > > ColA <- c("m", "m", "m", "m") > ColB<- c("d","d","d","d") > > And I would like to reorder them into a new column that looks like this: > > ColC<- c("m","d","m","d","m","d","m","d") > > Thank you! > > Stephanie > > ________________________________ > PHRI DISCLAIMER > This information is directed in confidence solely to the person named above > and may not otherwise be distributed, copied or disclosed. Therefore, this > information should be considered strictly confidential. If you have received > this email in error, please notify the sender immediately via a return email > for further direction. Thank you for your assistance. > > [[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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
One way: as.vector(t(cbind(ColA, ColB))) Ross, Stephanie wrote:> Hello, > > I have a general formatting question. I have two columns of data: > > ColA <- c("m", "m", "m", "m") > ColB<- c("d","d","d","d") > > And I would like to reorder them into a new column that looks like this: > > ColC<- c("m","d","m","d","m","d","m","d") > > Thank you! > > Stephanie > > ________________________________ > PHRI DISCLAIMER > This information is directed in confidence solely to the person named above and may not otherwise be distributed, copied or disclosed. Therefore, this information should be considered strictly confidential. If you have received this email in error, please notify the sender immediately via a return email for further direction. Thank you for your assistance. > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.