R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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. > > 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(119.880,131.468,155.089,149.581,122.788,143.900,112.115,109.600,117.446,118.456,101.901,89.940,129.143,126.102,143.048,142.258,131.011,146.471,114.073,114.642,118.226,111.338,108.701,80.512,146.865,137.179,166.536,137.070,127.090,139.966,122.243,109.097,116.591,111.964,109.754,77.609,138.445,127.901,156.615,133.264,143.521,152.139,131.523,113.925,86.495,127.877,107.017,78.716,138.278,144.238,143.679,159.932,136.781,148.173,125.673,105.573,122.405,128.045,94.467,85.573) > par3 = '1e-08' > par2 = '80' > par1 = '1' > par1 <- as.numeric(par1) > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > stem(x,par1,par2,par3) The decimal point is 1 digit(s) to the right of the | 7 | 89 8 | 166 9 | 04 10 | 26799 11 | 001224457788 12 | 02236678889 13 | 112377788 14 | 0234444678 15 | 0257 16 | 07 > > #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('
',RC.texteval('stem(x,par1,par2,par3)'),'
',sep='')) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/1082x1324209456.tab") > > > > proc.time() user system elapsed 0.215 0.044 0.273