Skip to content
Prev 205261 / 398506 Next

R2HTML Report number format, or Better Way?

L.A. wrote:
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()