X-Git-Url: http://www.iramuteq.org/git?a=blobdiff_plain;f=Rlib%2FtextometrieR%2FR%2Fpareto.R;fp=Rlib%2FtextometrieR%2FR%2Fpareto.R;h=85a0db43f77b4786066b6d7ff91988348d3af18f;hb=1a995a6ca4e8dbb09c8b9ab1276dabf17e065f0d;hp=0000000000000000000000000000000000000000;hpb=4045d224033dfcdad2f00d2ebd86a9026c32fca2;p=iramuteq diff --git a/Rlib/textometrieR/R/pareto.R b/Rlib/textometrieR/R/pareto.R new file mode 100644 index 0000000..85a0db4 --- /dev/null +++ b/Rlib/textometrieR/R/pareto.R @@ -0,0 +1,33 @@ +#* +#* Textometrie +#* ANR project ANR-06-CORP-029 +#* http://textometrie.ens-lsh.fr/ +#* +#* 2008 (C) Textometrie project +#* BSD New and Simplified BSD licenses +#* http://www.opensource.org/licenses/bsd-license.php + +`pareto` <- +function (x) { + op <- par(mar = c(5, 4, 4, 5) + 0.1) + par(las=2) + if( ! inherits(x, "table") ) { + x <- table(x) + } + x <- rev(sort(x)) + plot( x, type='h', axes=F) + # , lwd=16 + axis(2) + points( x, type='h', lwd=6) # , col=heat.colors(length(x)) + + y <- cumsum(x)/sum(x) + par(new=T) + plot(y, type="b", lwd=3, pch=7, axes=F, xlab='', ylab='', main='') + points(y, type='h') + axis(4) + #print(names(x)) + axis(1, at=1:length(x), labels=names(x)) + par(op) + title("Pareto graphic with cumulative frequency"); +} +