R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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(0.125 + ,1.111111111 + ,2.857142857 + ,0.714285714 + ,1.461538462 + ,5 + ,2 + ,0.636363636 + ,0.826086957 + ,0.875 + ,2.392857143 + ,1.4 + ,2.25 + ,1.533333333 + ,0.125 + ,4 + ,6.833333333 + ,1.636363636 + ,2.275862069 + ,0.428571429 + ,2.5 + ,3.217391304 + ,2.078947368 + ,0 + ,1 + ,0.333333333 + ,1.428571429 + ,1.869565217 + ,1.625 + ,0.25 + ,0.894736842 + ,0.761904762 + ,0.825 + ,0.25 + ,0.147058824 + ,0.3125 + ,0.209677419 + ,0.363636364 + ,0.130434783 + ,0.1875 + ,0.857142857 + ,0.447761194 + ,1.433333333 + ,1.409090909 + ,0.733333333 + ,0.404761905 + ,0.181818182 + ,0.306666667 + ,0.407407407 + ,0.857142857 + ,1.8 + ,2.608695652 + ,2.1 + ,1.631578947 + ,1.111111111 + ,1.875 + ,1.307692308 + ,3.947368421 + ,4.086956522 + ,3.095238095 + ,2.714285714 + ,2.2 + ,2.413793103 + ,4.588235294 + ,3.333333333 + ,4.75 + ,2.96969697 + ,3.181818182 + ,3.692307692 + ,1.170731707 + ,1 + ,0.75 + ,0.384615385 + ,4 + ,4.260869565 + ,2.260869565 + ,3.666666667 + ,3.166666667 + ,1.9 + ,1.904761905 + ,2.117647059 + ,2.4375 + ,2.428571429 + ,2.684210526 + ,0.5 + ,2.761904762 + ,0.5625 + ,2.357142857 + ,1.233333333 + ,2.413793103 + ,3.588235294 + ,0.833333333 + ,0.5 + ,1.866666667 + ,1 + ,3.892857143 + ,1.444444444 + ,1.375 + ,1.487804878 + ,0 + ,0.722222222 + ,0.857142857 + ,1.615384615 + ,2 + ,0.541666667 + ,1.368421053 + ,2 + ,0.583333333 + ,1.117647059 + ,0.25 + ,1.714285714 + ,0.125 + ,0.892857143 + ,1.966666667 + ,0.071428571 + ,2.117647059 + ,0.583333333 + ,1.142857143 + ,2.545454545 + ,3.837837838 + ,2.4 + ,1.245283019 + ,1.5 + ,0 + ,2 + ,1 + ,2.043478261 + ,1.541666667 + ,0.652173913 + ,0 + ,0.333333333 + ,0.2 + ,0.619047619 + ,0.882352941 + ,1.3125 + ,1.142857143 + ,0.736842105 + ,0.625 + ,0.083333333 + ,2.476190476 + ,0.25 + ,1.357142857 + ,1.966666667 + ,1.535714286 + ,2.176470588 + ,1.533333333 + ,0 + ,1.633333333 + ,2.083333333 + ,2.84375 + ,1.113207547 + ,1.225 + ,0.125 + ,0.5 + ,0 + ,0.2 + ,1 + ,6.75 + ,1 + ,1 + ,0.772727273 + ,1.4375 + ,0.678571429 + ,0.6 + ,0.678571429 + ,0.933333333 + ,0.375 + ,1.266666667 + ,0.666666667 + ,0.857142857 + ,0.875 + ,0.866666667 + ,1.92 + ,0.727272727 + ,1.294117647 + ,1.157894737 + ,0.92 + ,1.047619048 + ,0.916666667 + ,3 + ,2.714285714 + ,2 + ,1.964285714 + ,2.777777778 + ,1.833333333 + ,4.125 + ,1.181818182 + ,1.863636364 + ,1.692307692 + ,2.777777778 + ,2.09375 + ,1.707317073 + ,1.272727273 + ,0.823529412 + ,1.263157895 + ,1.24 + ,2.444444444 + ,0.416666667 + ,1.210526316 + ,1.523809524 + ,0.833333333 + ,1.235294118 + ,0.4375 + ,1.5 + ,1.16 + ,1.761904762 + ,2.090909091 + ,2.178571429 + ,2.166666667 + ,1.583333333 + ,0.625 + ,4.875 + ,7.333333333 + ,2.424242424 + ,2.310344828 + ,4.25 + ,1.2 + ,2.36 + ,1.21875 + ,0 + ,0 + ,3 + ,3 + ,3.62962963 + ,2 + ,2.782608696 + ,3.666666667 + ,2 + ,2.8 + ,2.80952381 + ,3.294117647 + ,1.571428571 + ,1.894736842 + ,3.5625 + ,2.272727273 + ,4.409090909 + ,3.1875 + ,2.785714286 + ,1.263157895 + ,3 + ,3.705882353 + ,3.5 + ,2.571428571 + ,4.242424242 + ,5.108108108 + ,3.666666667 + ,2.421052632 + ,2.428571429 + ,1.821428571 + ,0.5 + ,1.5 + ,0 + ,3.1 + ,2.851851852 + ,2.111111111 + ,1.043478261 + ,3.333333333 + ,1.166666667 + ,1.6 + ,1.619047619 + ,1.529411765 + ,1.6875 + ,1.6875 + ,1.428571429 + ,0.631578947 + ,1 + ,1.92 + ,2.904761905 + ,2.35483871 + ,1.137931034 + ,3.529411765 + ,1.333333333 + ,1.666666667 + ,1.03030303 + ,1.555555556 + ,1.605263158 + ,2.285714286 + ,1.321428571 + ,3.076923077 + ,3.619047619 + ,0.916666667 + ,1.578947368 + ,2.238095238 + ,1.833333333 + ,2.058823529 + ,2.5625 + ,2.681818182 + ,1.5 + ,2.642857143 + ,2.384615385 + ,2.214285714 + ,4.941176471 + ,0.285714286 + ,3.1 + ,3.25 + ,4.75 + ,3.625 + ,1.2 + ,2.52) > par4 = 'Unknown' > par3 = 'FALSE' > par2 = 'grey' > par1 = '' > xlab = 'Comments per minute' > main = 'Comments Student/Activity/Minute' > par4 <- 'Unknown' > par3 <- 'FALSE' > par2 <- 'grey' > par1 <- '' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Histogram (v1.0.12) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_histogram.wasp/ > #Source of accompanying publication: > # > par1 <- as.numeric(par1) > if (par3 == 'TRUE') par3 <- TRUE > if (par3 == 'FALSE') par3 <- FALSE > if (par4 == 'Unknown') par1 <- as.numeric(par1) > if (par4 == 'Interval/Ratio') par1 <- as.numeric(par1) > if (par4 == '3-point Likert') par1 <- c(1:3 - 0.5, 3.5) > if (par4 == '4-point Likert') par1 <- c(1:4 - 0.5, 4.5) > if (par4 == '5-point Likert') par1 <- c(1:5 - 0.5, 5.5) > if (par4 == '6-point Likert') par1 <- c(1:6 - 0.5, 6.5) > if (par4 == '7-point Likert') par1 <- c(1:7 - 0.5, 7.5) > if (par4 == '8-point Likert') par1 <- c(1:8 - 0.5, 8.5) > if (par4 == '9-point Likert') par1 <- c(1:9 - 0.5, 9.5) > if (par4 == '10-point Likert') par1 <- c(1:10 - 0.5, 10.5) > postscript(file="/var/wessaorg/rcomp/tmp/168nf1397843132.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if(is.numeric(x[1])) { + if (is.na(par1)) { + myhist<-hist(x,col=par2,main=main,xlab=xlab,right=par3) + } else { + if (par1 < 0) par1 <- 3 + if (par1 > 50) par1 <- 50 + myhist<-hist(x,breaks=par1,col=par2,main=main,xlab=xlab,right=par3) + } + } else { + plot(mytab <- table(x),col=par2,main='Frequency Plot',xlab=xlab,ylab='Absolute Frequency') + } > dev.off() null device 1 > if(is.numeric(x[1])) { + myhist + n <- length(x) + + #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,hyperlink('http://www.xycoon.com/histogram.htm','Frequency Table (Histogram)',''),6,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Bins',header=TRUE) + a<-table.element(a,'Midpoint',header=TRUE) + a<-table.element(a,'Abs. Frequency',header=TRUE) + a<-table.element(a,'Rel. Frequency',header=TRUE) + a<-table.element(a,'Cumul. Rel. Freq.',header=TRUE) + a<-table.element(a,'Density',header=TRUE) + a<-table.row.end(a) + crf <- 0 + if (par3 == FALSE) mybracket <- '[' else mybracket <- ']' + mynumrows <- (length(myhist$breaks)-1) + for (i in 1:mynumrows) { + a<-table.row.start(a) + if (i == 1) + dum <- paste('[',myhist$breaks[i],sep='') + else + dum <- paste(mybracket,myhist$breaks[i],sep='') + dum <- paste(dum,myhist$breaks[i+1],sep=',') + if (i==mynumrows) + dum <- paste(dum,']',sep='') + else + dum <- paste(dum,mybracket,sep='') + a<-table.element(a,dum,header=TRUE) + a<-table.element(a,myhist$mids[i]) + a<-table.element(a,myhist$counts[i]) + rf <- myhist$counts[i]/n + crf <- crf + rf + a<-table.element(a,round(rf,6)) + a<-table.element(a,round(crf,6)) + a<-table.element(a,round(myhist$density[i],6)) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/2kmmk1397843133.tab") + } else { + mytab + reltab <- mytab / sum(mytab) + n <- length(mytab) + + #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,'Frequency Table (Categorical Data)',3,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Category',header=TRUE) + a<-table.element(a,'Abs. Frequency',header=TRUE) + a<-table.element(a,'Rel. Frequency',header=TRUE) + a<-table.row.end(a) + for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,labels(mytab)$x[i],header=TRUE) + a<-table.element(a,mytab[i]) + a<-table.element(a,round(reltab[i],4)) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/3rbye1397843133.tab") + } > > try(system("convert tmp/168nf1397843132.ps tmp/168nf1397843132.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.772 0.139 0.911