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.
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: