Skip to contents

Function will start backing up your files in their folder to .bak. Make sure to have a git initiated repository if you wish to upload to your GitHub repository.

Usage

start_backup_prefs(
  preference_path = "R/rstudio_preferences",
  github_backup = FALSE,
  copy_to_local = FALSE,
  open_backup_path = FALSE,
  git_message = "Backup of R Studio preferences on {Sys.Date()}",
  repository = "."
)

Arguments

preference_path

string. Path to local backup folder

github_backup

logical. Upload file to github.

copy_to_local

logical. Copy your .json files to local if TRUE. It will copy the files to the repository folder if specified.

open_backup_path

logical. Open the default backup folder for convenience if TRUE.

git_message

string. Your git commit message. Default is "Backup of R Studio preferences on Sys.Date()."

repository

string. Defaults to the current git repository. If you want to upload to another repository, specify the path.

Value

Backup rstudio_bindings.json, addins.json rstudio-bindings.json and r.snippets to .bak files in their native rstudioconfig folder. Then copy files to working directory in chosen file path and executes git push if github_backup = TRUE

Details

Function wrapper using backup_prefs(). if github_backup = TRUE, will then use those functions: copy_files_to_local() and upload_prefs_to_github()

Examples

# Copy files to the selected directory
temp_dir <- tempdir()
start_backup_prefs(copy_to_local = TRUE, preference_path = temp_dir)
#>  Preferences files copied to /tmp/RtmpsyOTkt
unlink(temp_dir)

if (FALSE) {
# Backup prefs to the current git initiated repository
start_backup_prefs(github_backup = TRUE)

# Backup prefs to another local git repository that is not the current one,
# matching one in the cloud
start_backup_prefs(github_backup = TRUE, repository = "../MyRStudioPrefs")
}