Skip to content

Instantly share code, notes, and snippets.

@sahirbhatnagar
Last active April 15, 2016 17:24
Show Gist options
  • Save sahirbhatnagar/d2264c64b0213308dfaa537af1bfd9a7 to your computer and use it in GitHub Desktop.
Save sahirbhatnagar/d2264c64b0213308dfaa537af1bfd9a7 to your computer and use it in GitHub Desktop.
---
title: "`mapply` and `rmarkdown` for exploratory analysis"
output:
html_document:
fig_height: 5
fig_width: 7
toc: true
toc_float: true
toc_depth: 4
---
```{r setup, echo=FALSE,warning=FALSE,message=FALSE,cache=FALSE, results='hide'}
library(ggplot2)
```
```{r QOL-indiv, eval=T}
parameters <- data.frame(varNames = c("mpg", "disp", "hp", "drat", "wt",
"qsec", "gear", "carb"),
actualNames = c("Miles per US gallon","Displacement cu.in.",
"Gross horsepower", "Rear axle ratio",
"Weight 1000 lbs", "quarter mile time",
"Number of forward gears",
"Number of carburetors"))
mtcars <- transform(mtcars, cyl = factor(cyl), am = factor(am,
labels = c("automatic","manual")))
boxplotByNumCyl <- mapply(knitr::knit_expand,
file = "boxplotTemplate.Rmd",
j = parameters$varNames,
k = parameters$actualNames)
```
Here we plot the continuous data by the number of cylinders.
`r knitr::knit(text = unlist(boxplotByNumCyl))`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment