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') } aphasic = c(56, 43, 30, 97, 67, 24, 76, 49, 46, 29, 46, 83, 93, 38, 25, 44, 66, 71, 54, 20, 25) retarded = c(90, 53, 32, 44, 47, 42, 58, 16, 49, 54, 81, 59, 35, 81, 41, 24, 41, 61, 31, 20) DF = data.frame(data=c(aphasic, retarded), group=c(rep('aphasic', length(aphasic)), rep('retarded', length(retarded)))) 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(aphasic, retarded) print(res) ## Use a nonparametric method: ## res = mood.medtest(data ~ group, data=DF) print('Median Test:') print(res)