Create a gist from an R object

Share:

Description

Create a gist from an R object

Usage

1
2
gist_create_obj(x = NULL, description = "", public = TRUE,
  browse = TRUE, pretty = TRUE, filename = "file.txt", ...)

Arguments

x

An R object, any of data.frame, matrix, list, character, numeric

description

(character) Brief description of gist (optional)

public

(logical) Whether gist is public (default: TRUE)

browse

(logical) To open newly create gist in default browser (default: TRUE)

pretty

(logical) For data.frame and matrix objects, create a markdown table. If FALSE, pushes up json. (default: TRUE)

filename

Name of the file to create. Default: file.txt

...

Further args passed on to link[httr]{POST}

Details

This function is specifically for going from R objects to a gist, whereas gist_create is for going from files or executing code

See Also

gist_create, gist_create_git

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
## data.frame
### by default makes pretty table in markdown format
row.names(mtcars) <- NULL
gist_create_obj(mtcars)
gist_create_obj(iris)
### or just push up json
gist_create_obj(mtcars, pretty = FALSE)

## matrix
gist_create_obj(as.matrix(mtcars))
## list
gist_create_obj(apply(mtcars, 1, as.list))
## character
gist_create_obj("hello, world")
## numeric
gist_create_obj(runif(10))

## Assign a specific file name
gist_create_obj("
## header2

hey there!", filename = "my_markdown.md")

## End(Not run)