
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)
}
x <- c(426.113,383.703,232.444,70.939,226.731,947.293,611.281,158.047,33.999,37.028,388.3,506.652,392.25,180.818,198.296,217.465,275.562,1030.944,57.47,136.452,556.277,213.361,274.482)
par3 = '1e-08'
par2 = '80'
par1 = '1'
par3 <- '1e-08'
par2 <- '80'
par1 <- '1'
#'GNU S' R Code compiled by R2WASP v. 1.2.291 ()
#Author: root
#To cite this work: Wessa P., (2012), Stem-and-leaf Plot (v1.0.5) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_stem.wasp/
#Source of accompanying publication: 
#
par1 <- as.numeric(par1)
par2 <- as.numeric(par2)
par3 <- as.numeric(par3)
stem(x,par1,par2,par3)

#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,'Stem-and-leaf Plot',1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,paste('<pre>',RC.texteval('stem(x,par1,par2,par3)'),'</pre>',sep=''))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file="/var/wessaorg/rcomp/tmp/1x1t81349176578.tab") 


