if(!requireNamespace('lattice', quietly = TRUE)){ install.packages('lattice', dependencies=TRUE, repos='http://cran.rstudio.com/') } library(lattice) ## This didn't work due to missing dependencies: ## ## if(!requireNamespace('RVAideMemoire', quietly = TRUE)){ ## install.packages('RVAideMemoire', dependencies=TRUE, repos='http://cran.rstudio.com/') ## } ## require('RVAideMemoire') ## ## Download the source code and install by hand: ## ## https://cran.r-project.org/web/packages/RVAideMemoire/index.html ## ## Source the code you will actuall use: ## if( file.exists('~/Software/RVAideMemoire/R/mood.medtest.R') ){ source('~/Software/RVAideMemoire/R/mood.medtest.R') } treated = c(92, 108, 112, 90, 88) ##treated = c(92, 108, 250, 90, 88) ## adjust one datum control = c(83, 90, 78, 90, 90, 106, 92, 78, 103, 98) DF = data.frame(data=c(treated, control), group=c(rep('treated', length(treated)), rep('control', length(control)))) DF$group = as.factor(DF$group) histogram(~ data | group, layout=c(1, 2), data=DF) ## Compare the means with a t-test: ## res = t.test(treated, control) print(res) ## Use a nonparametric method: ## res = mood.medtest(data ~ group, data=DF) print('Median Test:') print(res)