histelheim
histelheim

Reputation: 5098

Post a gist directly from R?

I would like to find a simple way of putting gists on Github from R. Assume I have an object I want to convert into a gist. Normally I would save it as a text file and then upload it manually on Github. Is there a better way?

How can I create a gist directly from an R object and upload it to Github?

Upvotes: 4

Views: 579

Answers (1)

sckott
sckott

Reputation: 5903

I would suggest using my package gistr - which is built for working with GitHub gists. There are many ways you can create gists, including from files on your machine, or from R objects. You can knit .Rmd files during the creation process before uploading, etc. An example:

install.packages("gistr")
library("gistr")
file <- system.file("examples", "stuff.md", package = "gistr")
gist_create(file, description='a new cool gist')
#> <gist>974fd41ff30de9814cc1
#>   URL: https://gist.github.com/974fd41ff30de9814cc1
#>   Description: a new cool gist
#>   Public: TRUE
#>   Created/Edited: 2015-07-03T00:19:18Z / 2015-07-03T00:19:18Z
#>   Files: stuff.md
#>   Truncated?: FALSE

Upvotes: 6

Related Questions