x <- c(210907
,120982
,176508
,179321
,123185
,52746
,385534
,33170
,101645
,149061
,165446
,237213
,173326
,133131
,258873
,180083
,324799
,230964
,236785
,135473
,202925
,215147
,344297
,153935
,132943
,174724
,174415
,225548
,223632
,124817
,221698
,210767
,170266
,260561
,84853
,294424
,101011
,215641
,325107
,7176
,167542
,106408
,96560
,265769
,269651
,149112
,175824
,152871
,111665
,116408
,362301
,78800
,183167
,277965
,150629
,168809
,24188
,329267
,65029
,101097
,218946
,244052
,341570
,103597
,233328
,256462
,206161
,311473
,235800
,177939
,207176
,196553
,174184
,143246
,187559
,187681
,119016
,182192
,73566
,194979
,167488
,143756
,275541
,243199
,182999
,135649
,152299
,120221
,346485
,145790
,193339
,80953
,122774
,130585
,112611
,286468
,241066
,148446
,204713
,182079
,140344
,220516
,243060
,162765
,182613
,232138
,265318
,85574
,310839
,225060
,232317
,144966
,43287
,155754
,164709
,201940
,235454
,220801
,99466
,92661
,133328
,61361
,125930
,100750
,224549
,82316
,102010
,101523
,243511
,22938
,41566
,152474
,61857
,99923
,132487
,317394
,21054
,209641
,22648
,31414
,46698
,131698
,91735
,244749
,184510
,79863
,128423
,97839
,38214
,151101
,272458
,172494
,108043
,328107
,250579
,351067
,158015
,98866
,85439
,229242
,351619
,84207
,120445
,324598
,131069
,204271
,165543
,141722
,116048
,250047
,299775
,195838
,173260
,254488
,104389
,136084
,199476
,92499
,224330
,135781
,74408
,81240
,14688
,181633
,271856
,7199
,46660
,17547
,133368
,95227
,152601
,98146
,79619
,59194
,139942
,118612
,72880
,65475
,99643
,71965
,77272
,49289
,135131
,108446
,89746
,44296
,77648
,181528
,134019
,124064
,92630
,121848
,52915
,81872
,58981
,53515
,60812
,56375
,65490
,80949
,76302
,104011
,98104
,67989
,30989
,135458
,73504
,63123
,61254
,74914
,31774
,81437
,87186
,50090
,65745
,56653
,158399
,46455
,73624
,38395
,91899
,139526
,52164
,51567
,70551
,84856
,102538
,86678
,85709
,34662
,150580
,99611
,19349
,99373
,86230
,30837
,31706
,89806
,62088
,40151
,27634
,76990
,37460
,54157
,49862
,84337
,64175
,59382
,119308
,76702
,103425
,70344
,43410
,104838
,62215
,69304
,53117
,19764
,86680
,84105
,77945
,89113
,91005
,40248
,64187
,50857
,56613
,62792
,72535)
par2 = '0'
par1 = '0'
par1 <- as.numeric(par1)
par2 <- as.numeric(par2)
x <- as.ts(x)
library(lattice)
postscript(file="/var/wessaorg/rcomp/tmp/1f51y1323952904.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
plot(x,type='l',main='Run Sequence Plot',xlab='time or index',ylab='value')
grid()
dev.off()
postscript(file="/var/wessaorg/rcomp/tmp/24ljx1323952904.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
hist(x)
grid()
dev.off()
postscript(file="/var/wessaorg/rcomp/tmp/3b5041323952904.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
if (par1 > 0)
{
densityplot(~x,col='black',main=paste('Density Plot   bw = ',par1),bw=par1)
} else {
densityplot(~x,col='black',main='Density Plot')
}
dev.off()
postscript(file="/var/wessaorg/rcomp/tmp/4sain1323952904.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
qqnorm(x)
qqline(x)
grid()
dev.off()
if (par2 > 0)
{
postscript(file="/var/wessaorg/rcomp/tmp/5b7yu1323952904.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
dum <- cbind(lag(x,k=1),x)
dum
dum1 <- dum[2:length(x),]
dum1
z <- as.data.frame(dum1)
z
plot(z,main='Lag plot (k=1), lowess, and regression line')
lines(lowess(z))
abline(lm(z))
dev.off()
if (par2 > 1) {
postscript(file="/var/wessaorg/rcomp/tmp/6kten1323952904.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
dum <- cbind(lag(x,k=par2),x)
dum
dum1 <- dum[(par2+1):length(x),]
dum1
z <- as.data.frame(dum1)
z
mylagtitle <- 'Lag plot (k='
mylagtitle <- paste(mylagtitle,par2,sep='')
mylagtitle <- paste(mylagtitle,'), and lowess',sep='')
plot(z,main=mylagtitle)
lines(lowess(z))
dev.off()
}
postscript(file="/var/wessaorg/rcomp/tmp/7jdxx1323952904.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
acf(x,lag.max=par2,main='Autocorrelation Function')
grid()
dev.off()
}
summary(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,'Descriptive Statistics',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'# observations',header=TRUE)
a<-table.element(a,length(x))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'minimum',header=TRUE)
a<-table.element(a,min(x))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Q1',header=TRUE)
a<-table.element(a,quantile(x,0.25))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'median',header=TRUE)
a<-table.element(a,median(x))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'mean',header=TRUE)
a<-table.element(a,mean(x))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Q3',header=TRUE)
a<-table.element(a,quantile(x,0.75))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'maximum',header=TRUE)
a<-table.element(a,max(x))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file="/var/wessaorg/rcomp/tmp/8bh8q1323952904.tab") 

try(system("convert tmp/1f51y1323952904.ps tmp/1f51y1323952904.png",intern=TRUE))
try(system("convert tmp/24ljx1323952904.ps tmp/24ljx1323952904.png",intern=TRUE))
try(system("convert tmp/3b5041323952904.ps tmp/3b5041323952904.png",intern=TRUE))
try(system("convert tmp/4sain1323952904.ps tmp/4sain1323952904.png",intern=TRUE))
try(system("convert tmp/5b7yu1323952904.ps tmp/5b7yu1323952904.png",intern=TRUE))
try(system("convert tmp/6kten1323952904.ps tmp/6kten1323952904.png",intern=TRUE))
try(system("convert tmp/7jdxx1323952904.ps tmp/7jdxx1323952904.png",intern=TRUE))

