First, specify basic info
account <- jap::your_account() project_name <- "mbd" projects_folder_name <- "Projects" drive <- TRUE # we want to use google drive
A note on using the drive
option. The set of tools of that feature use the
tidyverse package googledrive
, which requires a short set-up. First call
googledrive::drive_auth()
, this will open a pop-up window asking you to
sign-in your Google account, and grant permission to googledrive
to access and
edit your Drive folders.
There is a common issues with the Google API, reported here for example. There
is a fix to this on the latest implementation on GitHub, but not yet on CRAN (as
of 27/04/2020). So we recommend:
remotes::install_github("tidyverse/googledrive")
Then open a session. We are gonna use this session every time we want to execute tasks on the cluster
library(jap) session <- jap::open_session(account = account)
Then we setup the entire folder structure on three different places: local, peregrine and google drive
jap::create_folder_structure( project_name = project_name, projects_folder_name = projects_folder_name, drive = drive, account = account, session = session )
We can check the structure on the remote folder and on the drive folder
jap::remote_list.files( dir = projects_folder_name, account = account, session = session ) jap::drive_list.files( dir = projects_folder_name )
We can now install the package we need from Github
jap::remote_install.packages( github_name = "Giappo", package_name = project_name, account = account, session = session )
We can even install any package from CRAN. To do so it suffices to not specify the 'github_name' argument
jap::remote_install.packages( package_name = "ape", account = account, session = session )
Or we can run a function
cluster_folder <- "data" jap::run_on_cluster( package_name = "ape", function_name = "rtree", fun_arguments = "n = 10", cluster_folder = cluster_folder )
jap::remote_list.files(dir = "jap_scripts", cluster_folder = cluster_folder)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.