library(igraph) # igraph exports magrittr's pipe operator
tmp1 <- list("apple", "banana") %>% lapply(., `attributes<-`, list(type = "fruit"))
tmp2 <- list("carrot") %>% lapply(., `attributes<-`, list(type = "vegetable"))
append_attr(tmp1, tmp2)
rm(tmp1, tmp2)
Run the code above in your browser using DataLab