CRoan
CRoan

Reputation: 41

How to import a dataset from Dropbox?

I have an iPad Pro as my primary computer, and am running R Studio from a cloud server for a class. I am trying to figure out how to import data sets, since my local working directory is on the server. I have been trying to download the package repmis, since I have been reading that that package allows for data set import from Dropbox. However, when I try to download the package, I get "Error:configuration failed for openssl" and a similar one for curl. I tried to install openssl but instead it says I need to install "deb" for ubuntu operating systems, but I can't find that in R Studio in the package database. (And I can't install curl without openssl either) Any suggestions?

Upvotes: 4

Views: 12190

Answers (2)

Gerald Guglielmo
Gerald Guglielmo

Reputation: 1

urla<- 'https://www.dropbox.com/s/fakecode/xyz.txt?raw=1' 
bpdata<-read.table(urla, header=TRUE)


scode<-'https://www.dropbox.com/s/lp6fleehcsb3wi9/protoBP.R?raw=1'
source(scode)

readAndPlotZoomForYear(urla, 2019)

Basically I wanted to source code from a file in Dropbox and to use the read.table() function on a tab delineated data file. I found this could be done by replacing the string after the question mark with raw=1 in the Dropbox file links.

Upvotes: 0

hrbrmstr
hrbrmstr

Reputation: 78832

If it's a relatively straightforward data set like a CSV, XML, JSON or even an .RData file you can use a Dropbox sharing URL to read it. Here's an example (it's a live URL) for reading in a CSV directly from a shared Dropbox link:

read.csv("https://www.dropbox.com/s/7xg5u0z1gtjcuol/mtcars.csv?dl=1")

The dl=1 won't be the default from a "share this link" copy (it'll probably be dl=0.

Upvotes: 9

Related Questions