dogle <DOgle <at> northland.edu> writes:

> 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 try to avoid putting too complex things into Sexpr{}, because the text gets
unreadable. Normally I do the following (not tested), which should also work for
the "seven" example (put the texts into a vector for that)

(My default <<>> settting is hide)

<<>>=  
p = 0.00001
myp = ifelse(p<0.001,"$p<0.001$",paste("$p=",round(p,1),"$",sep="\n"))
@ 


The probability of error is \Sexpr{myp}

Dieter

______________________________________________
R-help@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.

Reply via email to