问题
I use DataCamp for online learning of R. Sometimes I would like to export the data used in the exercises, but I can't find an easy way to do so.
I know that there are instructions for downloading the videos or slides, and some courses provide some selected datasets for download in the course description. But how do I download data that I can access through the DataCamp exercise interface for export outside of the platform?
回答1:
A comfortable way to move data from one session to another is the function dput()
. If the data is big you could do it in steps:
dput(df[1:100, ])
dput(df[101:200, ])
# ...
# Finally rbind() in your local session and save to hardrive
回答2:
I eventually succeeded by using the DataCamp console to write the desired dataset as a CSV file, something like this in the console:
write.csv(df)
It wrote the entire output to the console and I dragged and copied the whole thing (in my case, over 4 MB of text). It was a properly formed CSV file which I saved and then imported into RStudio and then could play with as I pleased.
来源:https://stackoverflow.com/questions/53523721/how-can-i-export-data-from-datacamp