I have table I have a column that is a dataset I need to separate this data and unify them to "standard columns".
I have already been able to separate the contents of the column by doing this:
nrow temp area sep1 sep2 sep3 sep4 sep5 sep6
1 x x x x x x NA NA
2 x x x x x x x NA
3 x x x x NA NA NA NA
100000 x x x x x x x x
But I still need to do this:
nrow temp area sep1
1 x x x
2 x x x
3 x x x
100000 x x x
nrow temp area sep2
1 x x x
2 x x x
3 x x x
100000 x x x
nrow temp area sep3
1 x x x
2 x x x
3 x x NA
100000 x x x
nrow temp area sep4
1 x x x
2 x x x
3 x x NA
100000 x x x
nrow temp area sep5
1 x x NA
2 x x x
3 x x NA
100000 x x x
nrow temp area sep6
1 x x NA
2 x x NA
3 x x NA
100000 x x x
For this I tried to separate the columns and put them together with a loop of repetition, but I can not finish the code, below what I tried to do:
file_split = data.frame(colsplit(file_unic$UNIR, pattern=";", names=paste0("sep", 1:34)))### separar coluna
for(i in 1:ncol(file_split)){
uniao = cbind(file,sep) # juntar uma coluna previamente separada ao conjunto de dados
}
However, I would still need to place one block below the other. How can I finish this?