Recasting nested list of any depth
问题 Assume this simplified example: L <- list() L$Foo <- list() L$Foo$Bar <- list() L$Foo$Bar$VAR <- TRUE L$Lorem <- list() L$Lorem$Ipsum <- list() L$Lorem$Ipsum$Dolor <- list() L$Lorem$Ipsum$Dolor$VAR <- TRUE I will then melt this list with reshape2::melt(L) . That will output the following: value L3 L2 L4 L1 1 TRUE VAR Bar <NA> Foo 2 TRUE Dolor Ipsum VAR Lorem After some operations on certain cells in the value column, I'm then looking to recast this melted list into the exact same nested list