How about this: > x <- c(50,25,5,1,.1,.05) > ifelse(x >= 1, sprintf("%.0f", x), sprintf("%.2f", x)) [1] "50" "25" "5" "1" "0.10" "0.05" >
On Mon, Aug 16, 2010 at 4:33 PM, array chip <arrayprof...@yahoo.com> wrote: > sorry that I didn't give more details, thought it's going to be the same for > all > plots. It's the bxp() for boxplot. I have about couple of 10 such plots in a > for() loop, so would like to automate the process. Using "labels= " certainly > works, but it's manual work - plot by plot. Any other suggestions? > > Many thanks > > John > > > > ----- Original Message ---- > From: David Winsemius <dwinsem...@comcast.net> > To: array chip <arrayprof...@yahoo.com> > Cc: R-Help <r-h...@stat.math.ethz.ch> > Sent: Mon, August 16, 2010 1:19:57 PM > Subject: Re: [R] print numbers > > > On Aug 16, 2010, at 3:53 PM, array chip wrote: > >> Hi, >> >> When I plot, the axis ticks are printed as "50.00 25.00 10.00 1.00 0.05 >> 0.01", is there any way to print them as "50 25 10 1 0.05 0.01" instead? > > No example, so we don't even know which of the three plotting paradigms you > might be using, but if these are base graphics perhaps something along ht > elines > of: > > ... , labels =c("50", "25", "10", "1", "0.05", "0.01"), ... > > --David Winsemius, MD > West Hartford, CT > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.