[R] Simple R (in Sweave) Question

dogle DOgle at NORTHLAND.EDU
Mon Nov 3 00:34:51 CET 2008

I am writing a report using Sweave with specific R output incorporated into
the text using the Sexpr{} command.  I have run into two specific issues:

1)  If the result inside the Sexpr{} command is an integer less than 10 I
would like to print the “word” for that number – e.g., “seven” for 7.
2)  If a p-value is “equal to zero” to some arbitrary number of decimal
places -- e.g., formatC(pvalue,format=”f”,digits=4) returns 0.0000 -- I
would like to print “<0.00005”.

I have attempted searching R-help et al but am not sure what keywords to use
for these questions.  I can picture the format of functions to solve these
issues but would be interested in pointers to previous solutions if they

Thank you in advance for any help.

> sessionInfo()
R version 2.7.2 (2008-08-25) 

LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets  methods  

other attached packages:
 [1] xtable_1.5-3          RODBC_1.2-3           lattice_0.17-13      
 [4] chron_2.3-24          FSA_0.0-13            reshape_0.8.0        
 [7] Rcapture_1.1          quantreg_4.20         SparseM_0.78         
[10] plotrix_2.4-7         MASS_7.2-44           exactRankTests_0.8-17
[13] NCStats_0.0-12        TeachingDemos_2.3     sciplot_1.0-3        
[16] nortest_1.0           multcomp_1.0-2        mvtnorm_0.9-2        
[19] Hmisc_3.4-3           gplots_2.6.0          gtools_2.5.0         
[22] car_1.2-8             FSAdata_0.0-5         gdata_2.4.2          

loaded via a namespace (and not attached):
[1] cluster_1.11.11 grid_2.7.2      tools_2.7.2

View this message in context: http://www.nabble.com/Simple-R-%28in-Sweave%29-Question-tp20295139p20295139.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list