Skip to content

Instantly share code, notes, and snippets.

View koncina's full-sized avatar

Eric Koncina koncina

View GitHub Profile
@koncina
koncina / child.Rmd
Last active September 26, 2018 07:06
Render a child Rmd in a unilur box
This is the solution chunk written in a child Rmd file. The value of `my_var` defined in the parent Rmd is `r my_var`...
**markdown** formatting is possible and we can include additional code chunks:
```{r}
plot(cars)
```
```{block, opts.label = "alert"}
This is even a nested _Rmarkdowm_ box
```
@koncina
koncina / string_vector_plot.R
Last active March 23, 2018 12:47
Measure time to create string vector in Rcpp
library(tidyverse)
#Rcpp::sourceCpp('string_vector_time.cpp')
replicates <- 50
tibble(size = rep(20000, replicates * 2),
allocate = rep(c(FALSE, TRUE), each = replicates)) %>%
mutate(execution_time = map2(size, allocate, get_string_vector_times)) %>%
mutate(map(execution_time, enframe)) %>%
unnest() %>%
@koncina
koncina / iosp_dev.css
Created May 8, 2017 17:42
css to visualise the different div containers
slides > slide > hgroup:not(.auto-fadein) {
background: gray;
}
slides > slide > hgroup > h2 {
background: green;
}
slides > slide > hgroup > h3 {
background: yellow;
---
title: "New boxes"
author: "Eric Koncina"
date: "22 novembre 2016"
output:
iosp::ioslides_plus:
smaller: yes
widescreen: yes
fig_retina: null
---
@koncina
koncina / txtcol.R
Created September 16, 2016 06:35
Color text for Pdf or Html output
# From http://stackoverflow.com/a/37122306
txtcol <- function(x, color) {
outputFormat = knitr::opts_knit$get("rmarkdown.pandoc.to")
if (outputFormat == 'latex')
paste("\\textcolor{", color, "}{", x, "}", sep = "")
else if (outputFormat == 'html')
paste("<font color='", color, "'>", x, "</font>", sep = "")
else
x
}
@koncina
koncina / read_prism.R
Created September 6, 2016 14:39
Read a graphpad prism pzfx file in R
# Eric Koncina <mail@koncina.eu>; 01/09/2016
# Imports the tables from a graphpad prism xml file (*.pzfx) into a dataframe
# Works with simple tables (One way ANOVA)
library(xml2)
library(dplyr)
library(purrr)
library(readr)