R version 3.3.0 (2016-05-03) -- "Supposedly Educational" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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.001233571 + ,0.001191603 + ,0.001206621 + ,0.00120586 + ,0.001138928 + ,0.001162497 + ,0.001135096 + ,0.001208973 + ,0.001135885 + ,0.001161553 + ,0.001240995 + ,0.001240995 + ,0.001287824 + ,0.001287824 + ,0.001331877 + ,0.001331877 + ,0.001143986 + ,0.001143986 + ,0.001227161 + ,0.001227161 + ,0.001123431 + ,0.001123431 + ,0.001409642 + ,0.001409642 + ,0.001370732 + ,0.001370732 + ,0.001306659 + ,0.001306659 + ,0.001128968 + ,0.001128968 + ,0.002161571 + ,0.002160631 + ,0.002160728 + ,0.002161107 + ,0.002160753 + ,0.00216068 + ,0.002160826 + ,0.002175502 + ,0.002168982 + ,0.002170399 + ,0.002164025 + ,0.002164025 + ,0.002164111 + ,0.002164111 + ,0.002164501 + ,0.002162475 + ,0.002164184 + ,0.002163952 + ,0.002162426 + ,0.002161461 + ,0.002616873 + ,2.53243E-05 + ,2.53243E-05 + ,0.000123622 + ,0.000123622 + ,0.000218216 + ,0.000218216 + ,0.000392184 + ,0.001005409 + ,0.001005409 + ,0.0004436 + ,0.001388687 + ,0.000898832 + ,0.000790648 + ,0.000836051 + ,0.00092516 + ,0.000379395 + ,0.000628434 + ,0.000341227 + ,0.00115527 + ,0.00115527 + ,0.000814094 + ,0.000814094 + ,0.000884203 + ,0.000837259 + ,0.002990141 + ,0.001774753 + ,0.000837259 + ,0.000561992 + ,0.001774753 + ,0.000655166 + ,0.000561992 + ,0.001868657 + ,0.000655166 + ,0.003986088 + ,0.001868657 + ,0.000313469 + ,0.003986088 + ,0.001201073 + ,0.000313469 + ,0.001201073 + ,0.000973056 + ,0.000824682 + ,0.000973056 + ,0.000824682 + ,0.000820892 + ,0.000813665 + ,0.000820892 + ,0.000813665 + ,0.000765766 + ,0.000765766 + ,0.000808988 + ,0.000808988 + ,0.000762976 + ,0.000762976 + ,0.001061116 + ,0.001061116 + ,0.001060768 + ,0.001060768 + ,0.000595273 + ,0.000595273 + ,0.000778156 + ,0.000778156 + ,0.000776098 + ,0.000747626 + ,0.000236061 + ,0.000296073 + ,0.000776098 + ,0.00077612 + ,0.000747626 + ,0.000236061 + ,0.000296073 + ,0.00077612 + ,0.00077584 + ,0.000747476 + ,0.00077584 + ,0.000747476 + ,0.00077584 + ,0.000565126 + ,0.000562162 + ,0.00077584 + ,0.000565126 + ,0.000562162 + ,0.000776594 + ,0.000562806 + ,0.000559909 + ,0.000559948 + ,0.000776594 + ,0.000562806 + ,0.000559909 + ,0.000559948 + ,0.000777025 + ,0.000563755 + ,0.000777025 + ,0.000563755 + ,0.000776141 + ,0.000571358 + ,0.000562367 + ,0.000776141 + ,0.000571358 + ,0.000562367 + ,0.000787701 + ,0.000571358 + ,0.000613198 + ,0.000567052 + ,0.000787701 + ,0.000561513 + ,0.000781948 + ,0.000571358 + ,0.000567052 + ,0.000613198 + ,0.000783198 + ,0.000560198 + ,0.000561513 + ,0.000781948 + ,0.000563372 + ,0.000569027 + ,0.000777574 + ,0.000783198 + ,0.000560198 + ,0.000777649 + ,0.000559548 + ,0.000563372) > par4 = 'Unknown' > par3 = 'FALSE' > par2 = 'grey' > par1 = '' > xlab = 'x' > main = 'Histogram' > x <- as.matrix(read.csv(file='http://www.wessa.net/uploads/temp/data1.csv')); > 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/1obsy1464802512.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 { + barplot(mytab <- sort(table(x),T),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/2b3zq1464802512.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/32k061464802512.tab") + } > > try(system("convert tmp/1obsy1464802512.ps tmp/1obsy1464802512.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.968 0.212 2.176