Skip to content

Instantly share code, notes, and snippets.

@cristiano74
Created June 18, 2019 08:36
Show Gist options
  • Save cristiano74/382ee5c76e960fc41a5b871326f4052f to your computer and use it in GitHub Desktop.
Save cristiano74/382ee5c76e960fc41a5b871326f4052f to your computer and use it in GitHub Desktop.
Create and update gist via gistR
library("gistr")
Sys.setenv(GITHUB_PAT ="token_to_insert_here")
#https://help.github.com/articles/creating-an-access-token-for-command-line-use
gist_auth()
#### filename - code ######################################
stuffpath <- "C:/file_name_full_path"
###################################################à
#gist ID creation (only once) - ###############################################
#gist_create(files = stuffpath, description = 'full code', browse = FALSE)
##########################################################################
######### find gist ID to UPDATE #########################################################
t=grep("gist_id_to_insert_here", gists(what = "minepublic"))
##########################################################################
gists(what = "minepublic")[[t]] %>% # List my public gists, and index to get just the 1st one
add_files(stuffpath) %>% # Add a new file to that gist
update() # update sends a PATCH command to the Gists API to add the file to your gist online
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment