Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Last active October 7, 2015 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramnathv/3236680 to your computer and use it in GitHub Desktop.
Save ramnathv/3236680 to your computer and use it in GitHub Desktop.
knitr with Examples
require(tools)
help_geom = grep('/geom_.*$', Rd_db('ggplot2'))
db = Rd_db('ggplot2')
geoms = lapply(db[grepl('/geom_.*$', names(db))], function(g){
capture.output(Rd2ex(g))
}
require(tools)
Rdx = Rd_db('ggplot2')
Rdg = Rdx[grepl('/geom_.*$', names(Rdx))]
x1 = paste(capture.output(Rd2HTML(Rdg[[1]], fragment = TRUE)), collapse = '\n')
x2 = paste(capture.output(Rd2ex(Rdg[[1]])), collapse = '\n')
library(tools)
infiles <- Rd_db('ggplot2')
Rd <- infiles[[40]]
tags <- gsub("\\", "", tools:::RdTags(Rd), fixed = TRUE)
get_tag <- function(x, kind){
tools:::.Rd_get_metadata(x, )
}
y = lapply(tags, tools:::.Rd_get_metadata, x = Rd)
names(y) = tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment