Here I am again with question I'll feel foolish for asking, when I see the answer. I'm trying to produce a report and here's where I get stuck: How do I get R2HTML to produce the same number format? Particularly remove the decimal places for Par and Sal. Are there better methods to produce this type of report? Thanks, L.A. R version 2.10.0 XP srtype<-cbind(Par,Sal,Median,COD,PRD,LowerCI,UpperCI) srtype Par Sal Median COD PRD LowerCI UpperCI RES I 9683 578 0.9533 29.69 1.191 0.9382 0.9582 RES V 4003 155 0.9763 16.51 1.091 0.9499 0.9943 OTHER 1542 10 0.8367 82.35 1.253 0.4759 2.2293 COM I 1711 26 0.9521 26.01 1.102 0.7811 0.9789 COM 9 1 0.9313 0.00 1.000 0.0000 0.0000 library(R2HTML) HTMLStart(outdir="c:/R/reports", file="myreport1", extension="html", echo=FALSE, HTMLframe=TRUE) HTML(srtype) HTMLhr() HTMLStop() Par Sal Median COD PRD LowerCI UpperCI RES I 9683.00 578.00 0.95 29.69 1.19 0.94 0.96 RES V 4003.00 155.00 0.98 16.51 1.09 0.95 0.99 OTHER 1542.00 10.00 0.84 82.35 1.25 0.48 2.23 COM I 1711.00 26.00 0.95 26.01 1.10 0.78 0.98 COM V 9.00 1.00 0.93 0.00 1.00 0.00 0.00 -- View this message in context: http://n4.nabble.com/R2HTML-Report-number-format-or-Better-Way-tp997787p997787.html Sent from the R help mailing list archive at Nabble.com.
On 01/04/2010 03:36 AM, L.A. wrote:> Here I am again with question I'll feel foolish for asking, when I > see the answer. > I'm trying to produce a report and here's where I get stuck: > How do I get R2HTML to produce the same number format? > Particularly remove the decimal places for Par and Sal. > Are there better methods to produce this type of report? >Hi L.A., Try this: # la1.dat is a text file with your sample data srtype<-read.table("la1.dat",header=TRUE) # I don't know where the rownames came from # so I added them rownames(srtype)<- c("RES I","RES V","OTHER","COM I","COM") library(prettyR) delim.table(srtype,"srtype.html",delim="<td>", tabegin="<table border=0>",bor="<tr><td>", tablend="</table>",header="<html><body>", trailer="</body></html>") Now have a look at the file "srtype.html". Jim
L.A. wrote:> > Here I am again with question I'll feel foolish for asking, when I > see the answer. > I'm trying to produce a report and here's where I get stuck: > srtype<-cbind(Par,Sal,Median,COD,PRD,LowerCI,UpperCI) > srtype > >Chances are better to get a reply when you supply the data as code as in the example below Maybe Eric Lecoutre could have a look at it. Dieter srtype=data.frame(Par=as.numeric(1000:1005), Sal=as.numeric(1:6),Median=rnorm(6)) srtypeM = as.matrix(srtype) library(R2HTML) HTMLStart(outdir="c:/tmp", file="myreport1", extension="html", echo=FALSE, HTMLframe=TRUE) # Use a data frame: will make column-wise decisions HTML(srtype) # When you have a matrix... HTML(srtypeM) # ... using the format arguments should work, but.... # I think this might be a bug, because only the first # in the vector is used. HTML(srtypeM,nsmall=c(1,5,7),digits=c(2,9,10)) # Same happens in the examples on the doc page HTML(iris[1:2,1:2],nsmall=c(2,5)) HTMLhr() HTMLStop() -- View this message in context: http://n4.nabble.com/R2HTML-Report-number-format-or-Better-Way-tp997787p997914.html Sent from the R help mailing list archive at Nabble.com.
Hi L.A., Use the package 'hwriter' to produce HTML pages/objects. > library(hwriter) > hwrite(srtype, page="c:/R/reports/myreport1.html") 'hwrite' can be combined with the function 'format' (to manage number format, digits, decimal places, etc...) and supports advanced HTML/CSS formatting options. Best regards, Greg --- Gregoire Pau EMBL Research Officer http://www.ebi.ac.uk/~gpau/ L.A. wrote:> Here I am again with question I'll feel foolish for asking, when I > see the answer. > I'm trying to produce a report and here's where I get stuck: > How do I get R2HTML to produce the same number format? > Particularly remove the decimal places for Par and Sal. > Are there better methods to produce this type of report? > Thanks, > L.A. > R version 2.10.0 XP > > srtype<-cbind(Par,Sal,Median,COD,PRD,LowerCI,UpperCI) > srtype > > Par Sal Median COD PRD LowerCI UpperCI > RES I 9683 578 0.9533 29.69 1.191 0.9382 0.9582 > RES V 4003 155 0.9763 16.51 1.091 0.9499 0.9943 > OTHER 1542 10 0.8367 82.35 1.253 0.4759 2.2293 > COM I 1711 26 0.9521 26.01 1.102 0.7811 0.9789 > COM 9 1 0.9313 0.00 1.000 0.0000 0.0000 > > > library(R2HTML) > HTMLStart(outdir="c:/R/reports", file="myreport1", > extension="html", echo=FALSE, HTMLframe=TRUE) > HTML(srtype) > HTMLhr() > HTMLStop() > > Par Sal Median COD PRD LowerCI UpperCI > RES I 9683.00 578.00 0.95 29.69 1.19 0.94 0.96 > RES V 4003.00 155.00 0.98 16.51 1.09 0.95 0.99 > OTHER 1542.00 10.00 0.84 82.35 1.25 0.48 2.23 > COM I 1711.00 26.00 0.95 26.01 1.10 0.78 0.98 > COM V 9.00 1.00 0.93 0.00 1.00 0.00 0.00 > >