Skip to content

Instantly share code, notes, and snippets.

View PhilipPallmann's full-sized avatar

Philip Pallmann PhilipPallmann

  • Cardiff University
  • Cardiff, UK
View GitHub Profile
@kevinushey
kevinushey / position_jitterdodge.R
Last active August 29, 2015 13:57
Combine position_jitter and position_dodge so points can align with boxplots in ggplot2
#' Jitter-dodge points to align them with a boxplot including fill aesthetic
#'
#' @family position adjustments
#' @param width degree of jitter in x direction. Defaults to 40\% of the
#' resolution of the data.
#' @param height degree of jitter in y direction. Defaults to 40\% of the
#' resolution of the data
#' @export
#' @examples
#' dsub <- diamonds[ sample(1:nrow(diamonds), 1000), ]
@DASpringate
DASpringate / simulated_insect_data
Last active January 11, 2017 07:47
R code to produce a simulated dataset for an experiment on a made up insect. Measures include sex, body length, thorax width, number of thoracic bristles and some measure of aggression behaviour. Also there is exposure to some treatment stimulus/drug. This simulation uses Copulas to generate correlated variables from binomial, Gaussian and Poiss…
# R code to produce a simulated dataset for an experiment on a made up insect.
# Measures include sex, body length, thorax width, number of thoracic bristles and some measure of aggression behaviour.
# Also there is exposure to some treatment stimulus/drug.
# This simulation uses Copulas to generate correlated variables from binomial, Gaussian and Poisson distributions
require(copula)
set.seed(1888)
n <- 1000
@daniel-gerhard
daniel-gerhard / boxplot with eyes
Created June 25, 2013 12:47
Boxplot with eyes
boxplot_eyes <- function(formula, data, col="yellow", boxwex=0.8){
if (boxwex > 1) boxwex <- 1
bw <- boxwex/2
# Ellipsen plot Funktion
eli <- function(r,e){
theta <- seq(0,2*pi,len=1000)
matrix(c(r*cos(theta),e*r*sin(theta)),ncol=2)
}
# Boxplot
bp <- boxplot(formula, data=data, col=col, boxwex=boxwex)