This post suggests a way to write a list to a file.
lapply(mylist, write, "test.txt", append=TRUE, ncolumns=1000)
The issue with this technic is that part of the information of the list (the structure into subparts and the names of the subparts) disappear and it is therefore very complicated (or impossible if we lost the extra information) to recreate the original list from the file.
What is the best solution to export and import (without causing any modification, including the names) a list?
dput
dump
orsave
will all write out R objects to an external file.save
will give a binary format while the other two text representations. – Middleoftheroad?saveRDS
or something? – Broodercat(capture.output(print(my.list), file="test.txt")
although I think the dput strategy will be superior since it can besource()
-ed – Cyaninedput
anddget
. Can you convert your comment into an answer? Thanks. – Rea