R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 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(1474200,1419600,1501500,1201200,1556100,1528800,1638000,1692600,1883700,1638000,1556100,1938300,1638000,1228500,1446900,1092000,1528800,1255800,1665300,1501500,1583400,1774500,1747200,2074800,1501500,1255800,1392300,1010100,1446900,1119300,1583400,1501500,1337700,1911000,1719900,1965600,1474200,1365000,1228500,1010100,1337700,1201200,1638000,1583400,1365000,1829100,1692600,2184000,1747200,1064700,1064700,1064700,1255800,1255800,1692600,1556100,1392300,1747200,1610700,2320500,1829100,1064700,1119300,928200,1283100,1474200,1856400,1829100,1474200,1719900,1528800,2184000,1665300,1337700,1201200,900900,1337700,1610700,1883700,1774500,1310400,1883700,1474200,2265900,1883700,1365000,1255800,846300,1337700,1283100,1938300,1938300,1474200,1911000,1419600,2211300,1883700,1392300,1064700,737100,1446900,1392300,1829100,2102100,1556100,1747200,1310400,2265900) > #'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: splines Loading required package: Formula 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/14qq91439750895.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/2h9001439750895.tab") > > try(system("convert tmp/14qq91439750895.ps tmp/14qq91439750895.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.849 0.109 0.956