Thanks Ryan, I'll try this also. But, assume if we have "n" nu of cols then how to use .. ? I have shown only 5 cols, in some case there will be more than 40/50 cols and this is dynamic..
Also, can u pls say what is "c" and "d" ?
Thanks ..
New to R,using VCFR package. I have to break the repeated col. values into same col vertically displaying the output.
Sample Chr p-value AF MQ Sample Chr p-value AF MQ Sample Chr p-value AF MQ
A1 1 0.0533 30 40 A1 1 0.0633 35 45 A1 2 0.0753 35 45
I am trying to get the output,
Sample Chr p-value AF MQ
A1 1 0.0533 30 40
A1 1 0.0633 35 45
A1 2 0.0753 35 45
.......
.....
..
So on ..
I am using VCFR package to Read VCF Files and splitting their info field.
rbind(d[,c(1:5)], d[,c(6:10)], d[,c(11:15)])
Thanks Ryan, I'll try this also. But, assume if we have "n" nu of cols then how to use .. ? I have shown only 5 cols, in some case there will be more than 40/50 cols and this is dynamic..
Also, can u pls say what is "c" and "d" ?
Thanks ..
d is your data frame, c is the standard R c function for defining vectors. For a dynamic number, I'd probably just create a string and eval() it. I'm sure there's a much more elegant way to do that, but it's simple to implement.
Log in to answer this question.