[R] can rows of text be repeated using R to create a new datafile
Bob Green
bgreen at dyson.brisnet.org.au
Sat Jul 8 11:14:38 CEST 2006
I am hoping for some advice as to whether the following task can be
performed in R?
I have a spreadsheet with 325 rows x 3 columns. The data was collected from
40 individuals who in most instances generated 8 bi-polar constructs (the
poles are separated by //). The first column is the construct number =
1 to 325. The second is an id number =1 to 40; the third column is the
data to be coded. Because persons 1, 18 & 40 generated 9 rows of data, and
person 5, 10 rows; rows =325 not 320.
What I want to do is repeat each row a set number of times - hopefully 4
(the number of coders to code the data). Once repeated there would be 4
conids x 1 , 4 x 2 etc
. 4x 325.
Currently this is how the first 2 rows look:
conid person construct
1 1 offence against property // offence against person
2 1 insight & cooperative with treatment // lack insight
This is how I want them to look after editing.
conid person construct
1 1 offence against property // offence against person
1 1 offence against property // offence against person
1 1 offence against property // offence against person
1 1 offence against property // offence against person
2 1 insight & cooperative with treatment // lack insight
2 1 insight & cooperative with treatment // lack insight
2 1 insight & cooperative with treatment // lack insight
2 1 insight & cooperative with treatment // lack insight
2 1 insight & cooperative with treatment // lack insight
Any assistance is much appreciated,
Bob
More information about the R-help
mailing list