[R] change values in a character vector

Henri-Paul Indiogine hindiogine at gmail.com
Fri Aug 26 00:36:06 CEST 2011


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: hindiogine at gmail.com
Skype: hindiogine
Website: http://people.cehd.tamu.edu/~sindiogine



More information about the R-help mailing list