I have a small problem, when trying to combine columns using paste, I combine the first column and the last result of the for loop. Tell me how to combine all the results of the for loop, and not just the last one?
if(i==1 | j==2){
common.res <- data.table(res[,3])
f <- data.table(paste(common.res1[,1],common.res[,]))
}
My data:
x1 | x2 | x3 |
---|---|---|
20 | 30 | 40 |
20 | 30 | 40 |
20 | 30 | 40 |
What do I get after I fasten the columns in the loop:
x1 |
---|
20 40 |
20 40 |
20 40 |
What I want to get:
x1 |
---|
20 30 40 |
20 30 40 |
20 30 40 |