#Daten sind aus Excel in die Zwischenablage kopiert. bmw <- read.table(file("clipboard"),sep="\t",header = T) library(ggplot2) library(plyr) ggplot(bmw,aes(x=preis))+geom_histogram()+facet_wrap(~model)+xlab("Preis")+ylab("Anzahl") names(bmw) ddply(bmw,.(model),summarise,median(preis)) ddply(bmw,.(model),summarise,mean(preis)) ddply(bmw,.(model),summarise,sd(preis)) ddply(bmw,.(model,zylinder),summarise,mean(preis)) #oder tapply(bmw$preis,bmw$model,median) tapply(bmw$preis,bmw$model,mean) tapply(bmw$preis,bmw$model,sd) tapply(bmw$preis,bmw$model,var) tapply((bmw$preis,bmw$model,quantile,probs=0.25) tapply((bmw$preis,bmw$model,quantile,probs=0.75) tapply((bmw$preis,bmw$model,quantile,probs=0.75)-tapply((bmw$preis,bmw$model,quantile,probs=0.25) #gibt das gleiche wie tapply(bmw$preis,bmw$model,IQR) mean(bmw$preis[bmw$model=="x1"])