Skip to content

Instantly share code, notes, and snippets.

View phgrosjean's full-sized avatar

Philippe Grosjean phgrosjean

View GitHub Profile
@phgrosjean
phgrosjean / Setup chunk.R
Last active February 13, 2022 11:30
A typical setup chunk for SciViews::R Markdown documents
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
SciViews::R
```
@phgrosjean
phgrosjean / app.R
Last active February 11, 2020 20:49
Respirometer designer
library(shiny)
library(simecol)
ui <- fluidPage(
title = "Respirometer designer",
plotOutput(outputId = "O2Plot"),
hr(),
fluidRow(
column(3, offset = 0,
# Respirometer characteristics
@phgrosjean
phgrosjean / Zenodo_data.R
Last active September 6, 2025 10:53
Show how to read data from Zenodo directly into R
# Note: the URL corresponds to the 'Download' button on the page
trap <- data.io::read$csv("https://zenodo.org/record/2533383/files/export.csv?download=1")
@phgrosjean
phgrosjean / form.R
Last active October 1, 2019 09:16
Form
# Sketch for a form() function to be inserted in the future form.io R package
# Copyright (c) 2019, Philippe Grosjean (phgrosjean@sciviews.org)
#
# TODO:
# - Use something else than caption (may be comment?) for the default legend of
# the tables
# - ...
#' Form tabular and textual output of various R objects using markdown
#'
@phgrosjean
phgrosjean / Nteract R notebook.ipynb
Created January 8, 2019 08:01
Nteract R notebook.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"Ferme","Variete","Rendement"
"X","A",0.327
"X","A",0.289
"X","B",0.500
"X","B",0.510
"X","C",0.442
"X","C",0.463
"X","D",0.471
"X","D",0.460
"Y","A",0.532
"Ferme","Variete","Rendement"
"X","A",0.327
"X","B",0.500
"X","C",0.442
"X","D",0.471
"Y","A",0.532
"Y","B",0.599
"Y","C",0.516
"Y","D",0.638
"Z","A",0.269
@phgrosjean
phgrosjean / R config using colorout.R
Last active March 15, 2021 17:36
[R config using colorout]
ttyConfig <- function(prompt = "R", col = 7) {
if (isColorXterm()) {
## This is a scheme assuming black text on white background
colorout::setOutputColors256(normal = c(0, 0, 238), number = c(0, 0, 0),
negnum = c(0, 0, 88), zero = c(0, 0, 202), date = c(0, 0, 22),
string = c(0, 0, 17), const = c(0, 0, 54), false = c(0, 0, 202), true = 22,
infinite = c(0, 0, 202), stderror = 1, warn = c(1, 0, 1), error = c(1, 0, 1),
verbose = FALSE, zero.limit = .Machine$double.xmin)
}
## Colorize also the prompt and add a line before it
@phgrosjean
phgrosjean / aov.r
Last active November 7, 2016 13:24
ANOVA using gov()
data(ToothGrowth)
TG.aov <- aov(len ~ dose * supp, data = ToothGrowth)
anova(TG.aov)
par(mfrow = c(2,2))
plot(TG.aov)
par(mfrow = c(1,1))
coplot(len ~ dose | supp, data = ToothGrowth, panel = panel.smooth)