1

If we have a list in R and want to export it, the simplest way is to use:

capture.output(mylist, file = "NewFile.txt")

How do we then re-import the file "NewFile.txt" back into R as a list?

FlamingGoose
  • 153
  • 1
  • 9
  • 2
    You may save as .Rdata and load. Or as `.rds` with `saveRDS/readRDS` – akrun Feb 14 '22 at 16:38
  • How long is your list, roughly? Do you just need to save it and import it back into R, or will some other program use it? Does it have to be txt, or can you use a binary format like RDS, as suggested above? – divibisan Feb 14 '22 at 17:00
  • will quickly help you out, taking into account the comments that have been put accross. do `save(mylist, file = 'NewFile')` to save the work, then to use the list aggain, do `load('NewFile')` – Onyambu Feb 14 '22 at 17:03
  • 1
    Check out https://stackoverflow.com/questions/6602881/text-file-to-list-in-r – yaynikkiprograms Feb 15 '22 at 00:54

0 Answers0