Hi Kevin, I am not sure you will find anything other than manual tweaking, that will vary between no decimals for integers, some for small fractions, and scientific for very small. You can also look at: ?round ?format. If this is for code/a report, you could make any formatting you wanted with enough effort and those.
Best regards, Josh On Tue, Nov 15, 2011 at 8:18 AM, Kevin Burton <rkevinbur...@charter.net> wrote: > Has anyone come across the right combinations to print a limited number of > digits? My trial and error approach is taking too much time. Here is what I > have tried: > > > >> op <- options() > >> a <- c(1e-10,1,2,3,.5,.25) > >> names(a) <- c("A", "B", "C", "D", "E", "F") > >> # default > >> a > > A B C D E F > > 1.0e-10 1.0e+00 2.0e+00 3.0e+00 5.0e-01 2.5e-01 > >> options(digits = 4, scipen=5) > >> # Doesn't print exponents but there are too many trailing digits > >> a > > A B C D E > F > > 0.0000000001 1.0000000000 2.0000000000 3.0000000000 0.5000000000 > 0.2500000000 > > > >> options(digits = 3, scipen=4) > >> # Now we are back to exponents > >> a > > A B C D E F > > 1.0e-10 1.0e+00 2.0e+00 3.0e+00 5.0e-01 2.5e-01 > > > > I would like the integers to print as integers (1,2,3). The larger fractions > to print something like .5000 or .2500. And the very small number to use > exponents (1.0e-10) > > > > Is this possible? > > > > Thank you. > > > > Kevin > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ ______________________________________________ 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.