source('/home/pw/wessanet/cretab')


RC.capture <- function (expression, collapse = NULL) {
    resultConn <- textConnection('RC.resultText', open = 'w', local=TRUE)
    sink(resultConn)
    on.exit(function() {
        sink()
        close(resultConn)
    })
    expression
    on.exit(NULL)
    sink()
    close(resultConn)
    return(paste(c(RC.resultText, ''), collapse = collapse, sep = ''))
}
RC.texteval <- function (sourceText, collapse = NULL, echo = TRUE) {
    sourceConn <- textConnection(sourceText, open = 'r')
    on.exit(close(sourceConn))
    result <- RC.capture(source(file = sourceConn, local = FALSE, echo = echo, print.eval = TRUE), collapse = collapse)
    on.exit(NULL)
    close(sourceConn)
    res <- ''
    for(i in 1:length(result)) {
      if (result[i]!='') res <- paste(res,result[i],'
',sep='')
    }
    return(res)
}


myrfcuid = 'r0652316'

x <- c(3035,2552,2704,2554,2014,1655,1721,1524,1596,2074,2199,2512,2933,2889,2938,2497,1870,1726,1607,1545,1396,1787,2076,2837,2787,3891,3179,2011,1636,1580,1489,1300,1356,1653,2013,2823,3102,2294,2385,2444,1748,1554,1498,1361,1346,1564,1640,2293,2815,3137,2679,1969,1870,1633,1529,1366,1357,1570,1535,2491,3084,2605,2573,2143,1693,1504,1461,1354,1333,1492,1781,1915)
par4 = '12'
par3 = ''
par2 = ''
par1 = ''
ylimmax = ''
ylimmin = ''
ylab = 'value'
xlab = 'index or time'
main = 'Univariate Data'
par4 <- '12'
par3 <- ''
par2 <- ''
par1 <- ''
#'GNU S' R Code compiled by R2WASP v. 1.2.327 (Sat, 03 Sep 2016 21:44:04 +0200)
#Author: root
#To cite this work: Wessa P., (2016), Plot of univariate data series (v1.0.5) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_univariatedataseries.wasp/
#Source of accompanying publication: 
#
if (par4 != 'No season') {
par4 <- as.numeric(par4)
if (par4 < 4) par4 <- 12
}
summary(x)
n <- length(x)
postscript(file="/home/pw/wessanet/rcomp/tmp/1ry2c1485163941.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
if (par4=='No season') {
plot(x,col=2,type='b',main=main,xlab=xlab,ylab=ylab,xaxt='n')
axis(1,at=seq(1,n,10))
}
if (par4!='No season') {
plot(x,col=2,type='b',main=main,xlab=xlab,ylab=ylab,xaxt='n')
axis(1,at=seq(1,n,par4))
grid(nx=0,ny=NULL,col='black')
abline(v=seq(1,n,par4),col='black',lty='dotted')
}
dev.off()

a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Univariate Dataseries',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Name of dataseries',header=TRUE)
a<-table.element(a,par1)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Source',header=TRUE)
a<-table.element(a,par2)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Description',header=TRUE)
a<-table.element(a,par3)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Number of observations',header=TRUE)
a<-table.element(a,length(x))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file="/home/pw/wessanet/rcomp/tmp/2szef1485163941.tab") 
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Summary Statistics of dataseries x',1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,paste('<pre>',RC.texteval('summary(x)'),'</pre>',sep=''))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file="/home/pw/wessanet/rcomp/tmp/3h9bx1485163941.tab") 

try(system("convert /home/pw/wessanet/rcomp/tmp/1ry2c1485163941.ps /home/pw/wessanet/rcomp/tmp/1ry2c1485163941.png",intern=TRUE))
