Skip to content

Instantly share code, notes, and snippets.

View lcolladotor's full-sized avatar

Leonardo Collado-Torres lcolladotor

View GitHub Profile
@lcolladotor
lcolladotor / outliers.Rmd
Created August 28, 2013 19:31
Rmd file for generating http://rpubs.com/lcollado/7901 The main issue is that only the last DataTable will show in the html.
Remove outliers
===============
The goal is to remove outliers (by variable) by marking them as NA and keeping a record of which were outliers.
# Data
First, lets create a sample data set
```{r data}
@lcolladotor
lcolladotor / .Rprofile
Created August 30, 2013 18:57
.Rprofile to run knitrBootstrap
## For knitr bootstrap
## More info at http://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
require(knitrBootstrap)
knit_bootstrap_md(input=inputFile, output=outputFile, code_style="Brown Paper", chooser=c("boot", "code"), show_code=FALSE)
}
)
@lcolladotor
lcolladotor / outlier.Rmd
Created August 30, 2013 19:25
Updated outliers.Rmd with rawData instead of data and linking to the GitHub issue that solved the multi-table issue.
Remove outliers
===============
The goal is to remove outliers (by variable) by marking them as NA and keeping a record of which were outliers.
# Data
First, lets create a sample data set
```{r data}
@lcolladotor
lcolladotor / .Rprofile
Last active December 22, 2015 08:29
outliers.Rmd final version and .Rprofile for running knitrBootstrap in RStudio Edit: Added knitr::render_html() in the Rmd file and took it off from .Rprofile after re-reading https://github.com/jimhester/knitrBootstrap/issues/20
## For knitr bootstrap
## More info at http://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
library(knitrBootstrap)
knit_bootstrap_md(input=inputFile, output=outputFile, code_style="Brown Paper", chooser=c("boot", "code"), show_code=FALSE)
}
)
@lcolladotor
lcolladotor / .Rprofile
Created September 5, 2013 03:35
Basic example of using knitrBootstrap in RStudio
## For knitr bootstrap
## More info at http://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
library(knitrBootstrap)
knit_bootstrap_md(input=inputFile, output=outputFile, code_style="Brown Paper", chooser=c("boot", "code"), show_code=FALSE)
}
)
@lcolladotor
lcolladotor / .Rprofile
Last active December 23, 2015 15:19
Example on how to fix dTable() when Inf and -Inf values are present. Includes .Rprofile for using knitrBootstrap via RStudio
## For knitr bootstrap
## More info at http://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
library(knitrBootstrap)
knit_bootstrap_md(input=inputFile, output=outputFile, code_style="Brown Paper", chooser=c("boot", "code"), show_code=FALSE)
}
)
Quantiles from Rle's with long lengths
======================================
```{r echo=FALSE}
library(knitr)
render_html()
```
The goal is to calculate quantiles on aggregated long Rle's. The information is split by chr, and combining it naively fails.
@lcolladotor
lcolladotor / 2013-mm-dd-template.Rmd
Created November 9, 2013 17:33
Post template for bit.ly/FellBit
---
layout: post
title: CHANGEME
tags:
- CHANGEME
categories:
- CHANGEME
---
{% include JB/setup %}
@lcolladotor
lcolladotor / knit-to-post
Created November 9, 2013 17:58
Textmate command for creating Jekyll-Bootstrap posts via Knitr
#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
# Source some support functions we need.
. "${TM_SUPPORT_PATH}/lib/html.sh"
. "${TM_SUPPORT_PATH}/lib/webpreview.sh"
# Get the viewer program. Any program (that works with open -a <name>) can be used,
# except 'html' which is reserved to mean the internal HTML window. This is also the
# default option.
{% highlight r %}
## CHUNK
{% endhighlight %}