Tena koe Henri-Paul Does the following do what you want?
testVector <- LETTERS[1:3] temp <- matrix(c(rep(c(NA, 'foo'), each=length(testVector)), testVector, rep(c(NA, 'bar', 'blah'), each=length(testVector))), ncol=6) c(t(temp)) HTH .... Peter Alspach > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Henri-Paul Indiogine > Sent: Friday, 26 August 2011 10:36 a.m. > To: r-help@r-project.org > Subject: [R] change values in a character vector > > Greetings! > > I have a 127 long vector with all different character entries. I > need to generate another vector that is 6 times a long and the second > one and has the following structure: > > NA > "foo" > "a unique string" > NA > "bar" > "blah" > NA > "foo" > "another unique string" > NA > "bar" > "blah" > ..... > > This has to be repeated 127 times, so that I have out of 6 entries the > first 2 and last 3 the same and at the 3rd position each of the unique > strings from the original character vector. > > I suppose this is possible in R, but I am at a loss of how to do so. > I suppose a loop with and index using multiples of 6, but I am not > sure. > > Thanks, > Henri-Paul > > -- > Henri-Paul Indiogine > > Curriculum & Instruction > Texas A&M University > TutorFind Learning Centre > > Email: hindiog...@gmail.com > Skype: hindiogine > Website: http://people.cehd.tamu.edu/~sindiogine > > ______________________________________________ > 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. The contents of this e-mail are confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, disseminate, distribute or reproduce all or any part of this e-mail or attachments. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. Any opinion or views expressed in this e-mail are those of the individual sender and may not represent those of The New Zealand Institute for Plant and Food Research Limited. ______________________________________________ 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.