0

i have the next problem... I have a list with the first element, a data frame with two variables (Product and Type), to be stored in a list "test" at position 1.

test[[1]]<-data.frame(Product = "Cheese", 
                  Type ="variable")

Automatically is stored as a dataframe within the list [[1]] list1x2 and i need to insert a lot of data with a for loop (but this is my little example), but I have a problem when i insert more dataframes to the same list, like this...

test[[1]]<- append(test[[1]], data.frame(Product = paste("Cheese","1Kg"),
                                    Type = "variation"))

is not a list with two dataframes :/

im trying to use

d_combinated<-do.call(rbind, test)

and

data.table::rbindlist(test)

and..

d_combinated<- dplyr::bind_rows(test, .id = "variable")

but i get...

Product Type Product Type
Cheese variable Cheese 1K variation

I need the next output...

Product Type
Cheese variable
Cheese 1K variation

Please, any suggestion is welcome. Thanks a lot!

0 Answers0