0

I know that there is a package (rDrop) to upload R objects into Dropbox.

I'm using stargazer to consolidate my regressions in clean HTML tables.

Is there a way to upload these into Dropbox as well? So not R objects? Or is there a workaround to get the job done - maybe by defining a working directory?

The main problem I'm facing is that I'm working from a cloud instance and cannot install Dropbox there. So I am looking for a way to upload to Dropbox without having a local Dropbox directory.

deca
  • 730
  • 1
  • 8
  • 24

1 Answers1

1

You can use the rDrop2 package to upload ANY file into Dropbox - it's just an API wrapper for the Dropbox service.

Below is some pseudocode which should work once you authenticate on your own machine using the package:

#load your data
data(iris)

#build your model
mod <- lm(Petal.Width ~ Sepal.Length + Sepal.Width, data=iris)

#save your html 
table_html <- stargazer::stargazer(mod, type = "html")

#write html to disk
write(x = table_html, file = "html_regression.html")

#get most recent version of the rdrop2 package
#not, the package is based on the v1 API which will soon cease to 
#function
install.packages("rdrop2")

#load library and authenticate
library(rdrop2)
drop_auth()

#check directory exists
drop_dir("stargazer_regressions")

#upload your html to dropbox
drop_upload("html_regression.html", dest = "stargazer_regressions")

Final output below:

enter image description here

Greg
  • 336
  • 1
  • 4
  • 6
  • thank you, this is really a great and easy solution! Do you know if there is / will be a similar solution once the current API interface ceases to function? – deca Aug 23 '17 at 06:35
  • In the case that the rdrop2 package isn't upgraded, you'd just have to update the functions you need to point to the new v2 api endpoints. – Greg Aug 24 '17 at 14:30