snippet yaml_notebook_html
#' ---
#' title: "${1:title}"
#' author: "${2:author}"
#' knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding, output_file = sprintf("%s_%s.html", format(Sys.Date(), "%y%m%d"), basename(tools::file_path_sans_ext(inputFile))))})
`r paste("#' date: '\u0060r paste(\u0022", format(Sys.time(), "%d/%m/%Y")," - Dernière MAJ:\u0022, format(Sys.time(), \u0022%d/%m/%Y\u0022))\u0060'", sep = "")`
#' output :
#' html_document:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variables: | |
CODECOV_TOKEN: "CODECOV_TOKEN_STRING" | |
_R_CHECK_CRAN_INCOMING_: "false" | |
_R_CHECK_FORCE_SUGGESTS_: "true" | |
APT_PKGS: "libcurl4-openssl-dev libssh2-1-dev libssl-dev libxml2-dev zlib1g-dev git" | |
before_script: | |
- apt-get update | |
- apt-get install -y --no-install-recommends ${APT_PKGS} | |
- apt-get install -y --no-install-recommends qpdf pandoc pandoc-citeproc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This function depends on the knitr and webshot packages, uncomment lines 2-6 below if you need to install them first | |
#install.packages("knitr") | |
#install.packages("devtools") | |
#library(devtools) | |
#devtools::install_github("wch/webshot") | |
#webshot::install_phantomjs() | |
#Feel free to move the library() calls for knitr and webshot outside the function. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Purpose: illustrate use of magick, gganimate, and purrr | |
## Inspiration: | |
## https://rud.is/b/2016/07/27/u-s-drought-animations-with-the-witchs-brew-purrr-broom-magick/ | |
## and subsequent discussion on magick vs gganimate: | |
## https://twitter.com/hrbrmstr/status/758304420224466944 | |
library(purrr) | |
library(ggplot2) | |
library(gganimate) | |
library(animation) | |
library(magick) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
required_packages <- c( | |
"dplyr", | |
"readr", | |
"ggplot2", | |
"ggthemes", | |
"futile.logger", | |
"lubridate" | |
) | |
packages_to_install <- required_packages[!(required_packages %in% installed.packages()[, 1])] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
games.howell <- function(grp, obs) { | |
#Create combinations | |
combs <- combn(unique(grp), 2) | |
# Statistics that will be used throughout the calculations: | |
# n = sample size of each group | |
# groups = number of groups in data | |
# Mean = means of each group sample | |
# std = variance of each group sample |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Polygon vertices for plotting computed from an object's linear dimensions | |
#' | |
#' This function takes a data frame (one row per object) of object dimensions, | |
#' where each object is defined by five linear measurements, and computes coords | |
#' of polygon vertices at given x and y values (taken from the data frame) | |
#' | |
#' @param data data frame with at least seven numeric columns | |
#' @param x column for x position of polygon centers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SOM example using wines data set | |
library(kohonen) | |
data(wines) | |
set.seed(7) | |
#create SOM grid | |
sommap <- som(scale(wines), grid = somgrid(2, 2, "hexagonal")) | |
## use hierarchical clustering to cluster the codebook vectors | |
groups<-3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# somewhat hackish solution to: | |
# https://twitter.com/EamonCaddigan/status/646759751242620928 | |
# based mostly on copy/pasting from ggplot2 geom_violin source: | |
# https://github.com/hadley/ggplot2/blob/master/R/geom-violin.r | |
library(ggplot2) | |
library(dplyr) | |
"%||%" <- function(a, b) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Interactive Presentations" | |
author: "Mikhail Popov (@bearloga)" | |
date: "December 4, 2015" | |
output: ioslides_presentation | |
runtime: shiny | |
--- | |
## Reduce Demo |