R version 3.3.0 (2016-05-03) -- "Supposedly Educational" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(84.97,85.57,85.74,85.88,85.88,85.96,85.96,85.99,86.02,86.14,86.3,86.32,86.32,86.77,87.47,87.39,87.3,87.31,87.31,87.38,87.4,87.32,87.37,87.4,87.4,87.89,87.7,87.89,88.02,88.08,88.08,88.15,88.21,88.41,88.39,88.41,88.41,89.1,90.35,90.61,91.18,91.22,91.22,91.4,91.52,91.68,91.71,91.77,91.77,92.16,93.64,93.78,93.96,93.82,93.82,93.89,94.05,94.46,94.62,94.72,94.72,95.76,96.14,97.11,97.19,97.43,97.43,97.56,97.66,97.75,97.82,97.82,97.82,98.35,98.19,98.19,98.21,98.22,98.26,98.23,98.26,98.5,98.51,98.51,98.51,98.89,99.55,99.9,100.12,100.09,100.09,100.09,100.46,100.71,100.79,100.79,100.93,101.15,101.53,101.91,102.18,102.24,102.2,102.32,102.43,102.45,102.84,102.96,102.96,103.1,103.4,103.74,103.97,104.29,104.33,104.46,104.9,105.31,105.63,105.68) > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Mean versus Median (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_meanversusmedian.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > library(Hmisc) Loading required package: grid Loading required package: lattice Loading required package: survival Loading required package: Formula Loading required package: ggplot2 Attaching package: 'Hmisc' The following objects are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > m <- mean(x) > e <- median(x) > postscript(file="/var/wessaorg/rcomp/tmp/1hzrk1463661593.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow=c(2,1)) > mydensity1 <- density(x,kernel='gaussian',na.rm=TRUE) > plot(mydensity1,main='Density Plot - Gaussian Kernel',xlab='Median (0 -> full line) | Mean (0 -> dashed line)',ylab='density') > abline(v=e,lty=1) > abline(v=m,lty=5) > grid() > myseq <- seq(0.01, 0.99, 0.01) > hd <- hdquantile(x, probs = myseq, se = TRUE, na.rm = FALSE, names = TRUE, weights=FALSE) > plot(myseq,hd,col=2,main='Harrell-Davis Quantiles',xlab='quantiles',ylab='Median (0 -> full) | Mean (0 -> dashed)') > abline(h=m,lty=5) > abline(h=e,lty=1) > grid() > par(op) > dev.off() null device 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Median versus Mean',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mean',header=TRUE) > a<-table.element(a,mean(x)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'median',header=TRUE) > a<-table.element(a,median(x)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/2yojm1463661593.tab") > > try(system("convert tmp/1hzrk1463661593.ps tmp/1hzrk1463661593.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.022 0.158 1.170