Description Usage Arguments Value Examples
PUTs new media into a Drive file, in the HTTP sense:
If the file already exists, we replace its content.
If the file does not already exist, we create a new file.
This is a convenience wrapper around drive_upload()
and
drive_update()
. In pseudo-code:
1 2 3 4 5 6 7 8 9 |
1 2 3 4 5 6 7 8 |
An object of class dribble
, a tibble with one row per file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # create a local file to work with
local_file <- tempfile("drive_put_", fileext = ".txt")
writeLines(c("beginning", "middle"), local_file)
# PUT to a novel filepath --> drive_put() delegates to drive_upload()
file <- drive_put(local_file)
# update the local file
cat("end", file = local_file, sep = "\n", append = TRUE)
# PUT again --> drive_put() delegates to drive_update()
file <- drive_put(local_file)
# create a second file at this filepath
file2 <- drive_create(basename(local_file))
# PUT again --> ERROR
drive_put(local_file)
# clean-up
drive_find("drive_put_.+[.]txt") %>% drive_rm()
unlink(local_file)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.