Learn R Programming

gistr (version 0.2.0)

gist_create_obj: Create a gist from an R object

Description

Create a gist from an R object

Usage

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

Examples

Run this code
## 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")

Run the code above in your browser using DataLab