-2

There are a large number of data.frame (more than 50). How can I save them quickly in .csv?

write.csv()

50 lines of code, it's awful...

Help me, guys!

zingy_b0y
  • 21
  • 4

1 Answers1

2

If I understand the many data.frames may be available in in your R session...

First create a vector with the names of the data.frames... use ls or some thing similar. Then use get to get the R object after the names (the data.frames in this case)

myfiles <- ls ()

Then

for (d in myfiles) {
    current <- get (d)
    write.csv (current, filename = paste0 (d, ".csv"))
}
dmontaner
  • 1,558
  • 12
  • 14