osfr (version 0.2.4)

osf_upload: Upload files to OSF

Description

Upload files to OSF

Usage

osf_upload(x, path, name = NULL, overwrite = FALSE, verbose = FALSE)

Arguments

x

an osf_tbl_node with a single project or component, or an osf_tbl_file with a single directory

path

Path to a local file. Ensure the file has a proper file extension (e.g., .docx) to ensure it's rendered properly on OSF.

name

Name of the uploaded file (if NULL, basename(path) will be used).

overwrite

Logical, overwrite an existing file with the same name (default FALSE)? If TRUE, OSF will automatically update the file and record the previous version.

verbose

Logical, indicating whether to print informative messages about interactions with the OSF API (default FALSE).

Value

an osf_tbl_file containing uploaded file

See Also

Examples

Run this code
# NOT RUN {
# Create an example file to upload to our example project
write.csv(iris, file = "iris.csv")
project <- osf_create_project("Flower Data")

# Upload the first version
osf_upload(project,"iris.csv")

# Modify the data file, upload version 2, and view it on OSF
write.csv(subset(iris, Species != "setosa"), file = "iris.csv")
project %>%
  osf_upload("iris.csv", overwrite = TRUE) %>%
  osf_open()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab