I have a set of data, with it's own metadata. I get some of the columns to list all the data from the given set of data.
Then I use this loops to store it in a matrix (I tried a data.frame and a list, but didn't work either). The entries are strings.
#############
ii_c <- metadades$item_id[metadades$tipus_item == "comentari"]
g_c <- metadades$grup[metadades$tipus_item == "comentari"]
i_c <- metadades$item[metadades$tipus_item == "comentari"]
in_c <- data_ent[, ii_c]
c_l <- list()
for(i in 1:ncol(in_c)){
c_l[[i]] <- in_c[,i][!is.na(in_c[,i])]
}
j <- 0
l <- 0
c_cl <- matrix(ncol=3)
for(i in 1:ncol(in_c)){
if(mode(c_l[[i]])=="numeric"){
j=j+1
} else {
for(k in 1:length(c_l[i])){
c_cl[i-j+l,] = c(g_c[i],i_c[i],c_l[i][k])
l=l+1
}
}
}
df_cl <- as.data.frame(c_cl)
#############
This way afterwards I would be able to plot it. Nevertheless I've tried to list (instead of making a matrix) all the dataframes and later on I could be able to cbind them (but it gave me errors aswell).
The next step would be to do a tableGrob and a grid.draw, to print it in a report.