Skip to content

Downloading a csv from Dropbox using the shareable link

5 messages · Bryan Hanson, Patrick Connolly, Timothy Bates

#
Hello Kindred R Spirits...

I'm trying to get a file (csv) from Dropbox using their shareable link  
concept.  They issue a short URL that goes to a web page where you see  
a button that says "Download File".  They don't really give you the  
URL of the file itself, just this page.  Is there a way to coax R into  
getting such a file?  I don't even really want the file per se, I just  
want a path to the file so I can reference it for Sweave purposes and  
read the contents into an object.  Seems like a job for RCurl but I  
have little experience and this seems like an odd case anyway.

By the way, I want to do this as a way to have several people on  
different computers run a .Rnw file that needs to access common data  
set w/o changing the path to the file each time a different person  
opens the file and works on it.  Perhaps there is another way of doing  
this.

Thanks for any suggestions.  Bryan
****************
Prof. Bryan Hanson
Dept of Chemistry & Biochemistry
DePauw University
Greencastle IN 46135 USA
#
The problem is that dropbox sharable links unpack to https URIs, and R doesn't support secture http (at least not on Mac, not sure about other platforms).


Would be great to compile the read.table etc. functions to use curl when it is installed, as curl supports a myriad of protocols.

Rcurl package seems to does this (but not on windows)

http://cran.r-project.org/web/packages/RCurl/RCurl.pdf

If your friends all use dropbox, they can get a common local path with something like "~Dropbox/file.Rnw"

t
On 20 May 2011, at 19:05, Bryan Hanson wrote:

            
#
On Fri, 20-May-2011 at 02:05PM -0400, Bryan Hanson wrote:

            
Dropbox allows you to share folders with other Dropbox users who would
then have access to your file/s as a file/s on their individual
computers.  It would mean that any collaborator would have to have a
Dropbox account and they'd all end up downloading the file.  If there
aren't too many for you to individually invite and it's not excessive
bandwidth for them to download that many copies of the file, it would
be easily done.  (You might even get yourself some more diskspace on
Dropbox by inviting other users.)

You'd have to think about whose version has what effect on others but
without knowing your objectives, it's impossible for me to say what's
the best approach.

HTH

  
    
#
Hi Patrick, here is the set up:

Everyone is already sharing all the files and has full access.  We  
have an Rnw file which generates a report and uses a csv file in a  
"nearby" directory.  Dropbox keeps it all sync'd.  But, if Person A is  
working on the file on their computer the path to the data would be  
(Mac OSX) /Users/PersonA/Dropbox/Project/data.csv  However, to Person  
B the path would be /Users/PersonB/Dropbox/data.csv  I'm looking for a  
way to keep the path to data.csv universal and independent of who is  
actually using the file.  That's why I was looking at the "shareable  
link" feature on Dropbox.

I guess I see two solutions (partially answering my own question now).

1.  Keep the data file in the same directory as the report and I don't  
think there would be any problems.
2. In the Rnw file, use a relative  path.  I know you can do this for  
instance when you specify where the graphics go.  I suppose the same  
approach would allow me to specify the path as going up one level and  
then down into a different directory.  As long as I bury these folders  
deep enough that I don't have to use a relative path that ever hits  
the "PersonX" level I suppose it will work.

I'll try it out.  Further suggestions welcome.  Thanks, Bryan
On May 20, 2011, at 8:24 PM, Patrick Connolly wrote:

            
#
just store the path as "~/Users/PersonB/Dropbox/data.csv" works for everyone