Re: [R] HTML nsmall vector format problem

From: tshort <tshort_at_eprisolutions.com>
Date: Fri 09 Jun 2006 - 20:53:37 EST

John,

I don't think nsmall uses a vector. Try the following with format (which HTML.data.frame uses):

> format(iris[1:2,1:2],nsmall=c(3,1))
  Sepal.Length Sepal.Width

1        5.100       3.500
2        4.900       3.000

It looks like you'll have to do a format column by column with a loop.

john seers (IFR) wrote:
>
>
> Hello All
>
> I am having a bit of trouble formatting my HTML with the desired number
> of digits after the decimal place. Am I doing something
> wrong/misunderstanding or is it a bug?
>
> Looking at the example supplied with ?HTML.data.frame:
>
> HTML(iris[1:2,1:2],nsmall=c(3,1),file="")
>
> Gives html output that includes the lines:
>
> </tr> <tr><td class=firstcolumn>1</td><td
> class=cellinside>5.100</td><td class=cellinside>3.500</td></tr>
> <tr><td class=firstcolumn>2</td><td class=cellinside>4.900</td><td
> class=cellinside>3.000</td></tr>
>
> My understanding of how nsmall works, as a vector, the output should be
> something like:
>
> </tr> <tr><td class=firstcolumn>1</td><td class=cellinside>5.100</td><td
> class=cellinside>3.5</td></tr>
> <tr><td class=firstcolumn>2</td><td class=cellinside>4.900</td><td
> class=cellinside>3.0</td></tr>
>
> i.e. first column with 3 digits after the decimal place and the second
> column with 1 digit after the decimal place.
>
> It appears to only use the first value in the vector.
>
> Has anybody got any suggestions?
>
> Thanks for any help.
>
> John Seers
>
>
>
> ---
>
> John Seers
> Institute of Food Research
> Norwich Research Park
> Colney
> Norwich
> NR4 7UA
>
>
> tel +44 (0)1603 251497
> fax +44 (0)1603 507723
> e-mail john.seers@bbsrc.ac.uk
> e-disclaimer at http://www.ifr.ac.uk/edisclaimer/
> <http://www.ifr.ac.uk/edisclaimer/>
>
> Web sites:
>
> www.ifr.ac.uk <http://www.ifr.ac.uk/>
> www.foodandhealthnetwork.com <http://www.foodandhealthnetwork.com/>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

--
View this message in context: http://www.nabble.com/HTML-nsmall-vector-format-problem-t1760896.html#a4791061
Sent from the R help forum at Nabble.com.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Jun 09 21:05:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 11 Jun 2006 - 05:34:52 EST.

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