Quantcast
Channel: Appending a list to a list of lists in R - Stack Overflow
Browsing latest articles
Browse All 8 View Live

Answer by Ederi for Appending a list to a list of lists in R

The purrr package has a lot of handy functions for working on lists. The flatten command can clean up unwanted nesting.resultsa <- list(1,2,3,4,5)resultsb <- list(6,7,8,9,10)resultsc <-...

View Article



Answer by Paul for Appending a list to a list of lists in R

Just a note on Brian's answer below, the first assignment to outlist can also be an append statement so you could also do something like this:resultsa <- list(1,2,3,4,5)resultsb <-...

View Article

Answer by Eduardo Bergel for Appending a list to a list of lists in R

This answer is similar to the accepted one, but a bit less convoluted.L<-list()for (i in 1:3) {L<-c(L, list(list(sample(1:3))))}

View Article

Answer by Jesse Burström for Appending a list to a list of lists in R

By putting an assignment of list on a variable firstmyVar <- list()it opens the possibility of hiearchial assignments bymyVar[[1]] <- list()myVar[[2]] <- list()and so on...so now it's possible...

View Article

Answer by Brian Diggs for Appending a list to a list of lists in R

There are two other solutions which involve assigning to an index one past the end of the list. Here is a solution that does use append.resultsa <- list(1,2,3,4,5)resultsb <-...

View Article


Answer by IRTFM for Appending a list to a list of lists in R

outlist <- list(resultsa)outlist[2] <- list(resultsb)outlist[3] <- list(resultsc)append's help file says it is for vectors. But it can be used here. I thought I had tried that before but there...

View Article

Answer by Daniel Fischer for Appending a list to a list of lists in R

Could it be this, what you want to have:# Initial list:myList <- list()# Now the new experimentsfor(i in 1:3){ myList[[length(myList)+1]] <- list(sample(1:3))}myList

View Article

Appending a list to a list of lists in R

I'm having issues appending data to a list which is already in a list format. I have a program which will export results objects during a simulation loop. The data itself is stored as a list of...

View Article

Browsing latest articles
Browse All 8 View Live




Latest Images