forked from karthik/rdrop2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
235 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,12 @@ Version: 0.8.2.1 | |
Authors@R: c(person("Karthik", "Ram", email = "[email protected]", role = c("aut", "cre")), | ||
person("Clayton", "Yochum", role = "aut"), | ||
person("Caleb", "Scheidel", role = "ctb"), | ||
person("Akhil", "Bhel", role = "cph") | ||
person("Akhil", "Bhel", role = "cph"), | ||
person(given = "Lewis", | ||
family = "Hounkpevi", | ||
role = "ctb", | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0001-5111-8568")) | ||
) | ||
Description: Provides full programmatic access to the 'Dropbox' file hosting platform <https://dropbox.com>, including support for all standard file operations. | ||
Depends: R (>= 3.1.1) | ||
|
@@ -19,7 +24,8 @@ Imports: | |
jsonlite, | ||
magrittr, | ||
purrr, | ||
readxl | ||
readxl, | ||
openxlsx | ||
Suggests: testthat, | ||
uuid | ||
RoxygenNote: 7.1.1 | ||
RoxygenNote: 7.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#' drop_save | ||
#' | ||
#'@param object R object to save | ||
#'@param path The relative path on Dropbox where the file should get uploaded. | ||
#'@param mode - "add" - will not overwrite an existing file in case of a | ||
#' conflict. With this mode, when a a duplicate file.txt is uploaded, it will | ||
#' become file (2).txt. - "overwrite" will always overwrite a file - | ||
#'@param autorename This logical determines what happens when there is a | ||
#' conflict. If true, the file being uploaded will be automatically renamed to | ||
#' avoid the conflict. (For example, test.txt might be automatically renamed to | ||
#' test (1).txt.) The new name can be obtained from the returned metadata. If | ||
#' false, the call will fail with a 409 (Conflict) response code. The default is `TRUE` | ||
#'@param mute Set to FALSE to prevent a notification trigger on the desktop and | ||
#' mobile apps | ||
#'@template verbose | ||
#'@template token | ||
#'@references \href{https://www.dropbox.com/developers/documentation/http/documentation#files-upload}{API documentation} | ||
#'@param ext file extension that will be saved. here we suggest csv, excel, rds, RData | ||
#'@param ... other arguments for write.csv, write.xlsx, readRDS, save | ||
#'@importFrom openxlsx write.xlsx | ||
#'@importFrom utils write.csv | ||
#'@author Lewis Hounkpevi | ||
#'@export | ||
#' | ||
#' @examples \dontrun{ | ||
#' drop_save(BOD, ext = "rds") | ||
#' drop_save(BOD, ext = "RData") | ||
#' drop_save(BOD, ext = "xlsx") | ||
#' drop_save(BOD, ext = "csv") | ||
#'} | ||
drop_save <- function (object, | ||
path = NULL, | ||
mode = "overwrite", | ||
autorename = TRUE, | ||
mute = FALSE, | ||
verbose = FALSE, | ||
dtoken = get_dropbox_token(), | ||
ext = c("csv", "xlsx", "rds", "RData"), | ||
...){ | ||
|
||
|
||
localpath <- paste0(tempdir(), "/", deparse(substitute(object)), ".", ext) | ||
|
||
|
||
|
||
if(ext == "csv") { | ||
|
||
write.csv(object, file = localpath, ...) | ||
|
||
}else if (ext == "xlsx" | ext == "xls"){ | ||
|
||
openxlsx::write.xlsx(object, file = localpath, ...) | ||
|
||
} else if(ext == "rds" ){ | ||
|
||
saveRDS(object, file = localpath, ...) | ||
|
||
} else if (ext == "RData" | ext == "rdata" | ext == "RDATA") { | ||
|
||
save(object, file = localpath, ...) | ||
} | ||
|
||
|
||
|
||
|
||
drop_upload(file = localpath, | ||
path = path, | ||
mode = mode, | ||
autorename = autorename, | ||
mute = mute, | ||
verbose = verbose, | ||
dtoken = dtoken) | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters