[R] Simple R (in Sweave) Question

From: dogle <DOgle_at_northland.edu>
Date: Sun, 02 Nov 2008 15:34:51 -0800 (PST)

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 exist.

Thank you in advance for any help.

> sessionInfo()
R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

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.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 02 Nov 2008 - 23:38:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 03 Nov 2008 - 08:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive