The goal of
cloudstoR is to simplify accessing data stored on Cloudstor via their WebDAV interface. You can use
cloudstoR to download or upload files, or check the contents of directories.
You can install from CRAN with:
Or install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("pdparker/cloudstoR")
For additional support for the package, check the pkgdown site.
You will need your Cloudstor username and password. The password is not the one you use to log on to Cloudstor. Instead you need to use an app password.
cloudstoR provides an option to store these credentials using
The first time you use a
cloudstoR will prompt you to store your credentials locally. You can choose not to do this by providing a username and password for each function call.
To retrieve a list of files in a folder, use
path argument specifies the folder to return.
cloud_list(path = "cloudstoR Tests") #>  "Another Folder/" "mydata1.csv" "mydata2.csv"
To retrieve a file use
cloud_get(), and provide the path to the file with the
my_data <- cloud_get(path = "cloudstoR Tests/mydata1.csv") my_data #> A B C #> 1 3 9 2 #> 2 2 5 9 #> 3 7 10 3
cloudstoR will try to open the file using
rio and return a data.frame. The temporary version of the file is deleted once it is read into memory. If you want to use a different package to open the file, or you just want to download and keep the file without opening it, set
open_file = FALSE to return a file path instead.
To upload a file, use
cloud_put(). You need to provide the path to the saved file (
local_file), and the path to save the file on Cloudstor (
path). You can optionally provide a name for the file (
file_name), otherwise the file name of the local file is used.
cloud_put( local_file = "~/datatosave.sav", path = "additional/path/to/folder", file_name = "mydata.sav", )
If you don’t know the exact file path you want to follow, you can find it with
You can view meta-data for a file or folder with
cloud_meta(). This can be especially useful for checking if a file has been modified.
cloud_meta(path = "cloudstoR Tests/mydata1.csv") #> file_name #> 1 /plus/remote.php/webdav/cloudstoR Tests/mydata1.csv #> tag file_modified file_size #> 1 "095d3de8121db760bef190fed3369278" Wed, 02 Mar 2022 22:27:13 GMT 35
If you need to delete your credentials (e.g., because you revoke your app password), you can restore them by calling
cloud_auth(reset_keys = TRUE)
The default WebDAV address is
https://cloudstor.aarnet.edu.au/plus/remote.php/webdav/. If your organisation uses a different address, you can set this globally at the top of your script: