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
#' 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), ] |
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
# 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 |
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
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) |