# NOT RUN {
d <- droplet_create() %>% droplet_wait()
# Upgrade system packages
d %>%
droplet_ssh("apt-get update") %>%
droplet_ssh("sudo apt-get upgrade -y --force-yes") %>%
droplet_ssh("apt-get autoremove -y")
# Install R
d %>%
droplet_ssh("apt-get install r-base-core r-base-dev --yes --force-yes")
# Upload and download files -------------------------------------------------
tmp <- tempfile()
saveRDS(mtcars, tmp)
d %>% droplet_upload(tmp, ".")
d %>% droplet_ssh("ls")
tmp2 <- tempdir()
d %>% droplet_download(basename(tmp), tmp2)
mtcars2 <- readRDS(file.path(tmp2, basename(tmp)))
stopifnot(all.equal(mtcars, mtcars2))
## another upload/download example
tmp <- tempfile(fileext = ".txt")
writeLines("foo bar", tmp)
readLines(tmp)
d %>% droplet_upload(tmp, ".")
d %>% droplet_ssh("ls")
tmp2 <- tempdir()
unlink(tmp)
d %>% droplet_download(basename(tmp), tmp2)
readLines(file.path(tmp2, basename(tmp)))
# }
Run the code above in your browser using DataCamp Workspace