Skip to content

Instantly share code, notes, and snippets.

View mmaechler's full-sized avatar

Martin Mächler mmaechler

View GitHub Profile
@mmaechler
mmaechler / first.Rmd
Last active August 29, 2015 13:56
First R Markdown example -- and demo about non-accurate decimal numbers
R Markdown: "Why 10 * 0.1 is rarely 1.0"
========================================================
This is an R Markdown document. Markdown is a simple formatting syntax for authoring web pages (in Rstudio click the **MD** toolbar button for help on Markdown).
When you click the **Knit HTML** button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
summary(cars)
```
@mmaechler
mmaechler / get-data.R
Created July 8, 2016 19:19 — forked from daroczig/get-data.R
Number of R packages submitted to CRAN
## original idea & report by Henrik Bengtsson at
## https://stat.ethz.ch/pipermail/r-devel/2016-February/072388.html
## This script downloads the list of currently published R packages
## from CRAN and also looks at all the archived package versions to
## combine these into a list of all R packages ever published on
## CRAN with the date of first release.
## CRAN mirror to use
CRAN_page <- function(...) {
@mmaechler
mmaechler / ifelse-checks.R
Last active November 28, 2016 18:07
`ifelse2()` - experiments for a new version of `ifelse()`
source("ifelse-def.R")
##' warnifnot(): a "only-warning" version of stopifnot():
##' {Yes, learn how to use do.call(substitute, ...) in a powerful manner !!}
warnifnot <- stopifnot
body(warnifnot) <- do.call(substitute, list(body(stopifnot),
list(stop = quote(warning))))
## (now, this was really cute ....)