Author: John Truckenbrodt

Beanplots

Create beanplots as alternative to boxplots. requires package beanplot. A discussion on differences between boxplots and violin plots to beanplots is given here. This post was inspired by this paper whose authors posted their code here. The distribution mean is visualized by a long black line. Standard deviation and median are visualized by green and red short lines, respectively. beanplotter <- function(dataframe, outname, yname, maxval = Inf){ require(beanplot) pdf(file = outname, width=2*ncol(dataframe), height = 5) par(mar = c(2,3,1,1)) #bottom, left, top, right par(mgp = c(1.5,0.5,0)) #axlabeldist,ticklabeldist,axdist beanplot::beanplot(dataframe, main = "",xlab = "", ylab = yname, axes = F, log...

Read More

Write shape file

write a spatial dataframe to a shapefile: shapewriter=function(data, name){ require(rgdal) rgdal::writeOGR(data, dsn = dirname(name), layer = tools::file_path_sans_ext(basename(name)), driver = 'ESRI Shapefile', verbose = FALSE, overwrite_layer = TRUE)...

Read More