Pages

Thursday, January 16, 2014

Importing data from Dropbox to R


Dropbox (www.dropbox.com) is one of several cloud-based data file sharing applications.  I find it useful to store and share data that is backed up automatically and accessible from anywhere.  Additionally, files can be shared and used by others.  Data from this site can be imported directly into R and eliminates local file storage (usually, see next post for exceptions), and eases development of reproducible research.  Below an example of importing a comma delimited text file (csv).  

To get started you must get a link from your Dropbox file using the share link tool that provides a browser-friendly link that you can share. Unfortunately, this link alone will not work as this assumes a user will click on the link to open the file and requires one additional step. 

Using the "dat" dataset as an example hosted on the shared folder on my dropbox.  Using the share link tool provides me with the following url: https://www.dropbox.com/s/tdtwlwbsssl0wpc/dat.csv.


To import into R, the link must be edited to the following: http://dl.dropbox.com/s/tdtwlwbsssl0wpc/dat.csv.  Notice only the first section is changed. 




No comments:

Post a Comment