similar to: printing decimal numbers

Displaying 20 results from an estimated 7000 matches similar to: "printing decimal numbers"

2003 Apr 11
3
summary.formula: method reverse does not use fun argument
hi, recently i discovered the functionability summary.formula, awesome! from the help page i understand that method=reverse allows to summarize all variables on the right hand side of formula (the help page on line 229 wrongly refers to the left? hand side variables) in categories which are determined by a single left hand side variable. my problem is that the argument fun seems not to be
2004 Jan 01
4
force fixed format
Hello, A small problem I can't solve > p <- 0.0001 > p [1] 1e-04 How can I force the printout of p to 0.0001? I have tried 'format', 'round', 'signif', 'print' in different combinations without success. Fredrik Lundgren
2007 Sep 23
2
Plotting numbers at a specified decimal length on a plot()
Hi there, I want to figure out how to plot means, with 2 decimal places, of any Y variable on a scatterplot according to any X variable (which obviously should have limited scope). I already figured out how to plot the means, but without limiting their precision to 2 decimal places. This is the code I used once I had the scatterplot drawn: text(c(1990, 1992, 1994, 1996, 1998, 1999, 2000,
2010 Feb 15
2
Printing 2 digits after decimal point
Hi there, i'm not getting along with the following problem. I'd like to print a real number, e.g. x <- 12.3 with exactly two digits after the decimal point, e.g. 12.30 I've tried the whole format(), formatC() and prettyNum() functions but did not have any success with it. This should work with all real numbers, in case even with 0.0 (-> 0.00). For cracks this thing is pretty
2012 Jul 07
5
number of decimal places in a number?
Dear R users, I need a function that gets a number and returns its number of actual decimal places. For example f(3.14) should return 2, f(3.142) should return 3, f(3.1400) should also return 2 and so on. Is such function already available in R? If not, could you give me a hint how to achieve that? Many thanks in advance. -----------------------------------------------------------------
2010 Jan 28
1
number of decimal
Hi everybody, I'm trying to set the number of decimals (i.e. the number of digits after the "."). I looked into options but I can only set the total number of digits, with options(digits=6). But since I have different variables with different order of magnitude, I would like that they're all displayed with the same number of decimals. I searched for it and found the format()
2018 Oct 25
1
small bug in formatC?
formatC(0.0001, digits = 3, format = "f", zero.print="< 0.01") Error in strrep(" ", nc - i1) : invalid 'times' value The problem, if it is one, is in .format.zeros: .format.zeros("0.000", "xxxxxx") Error in strrep(" ", nc - i1) : invalid 'times' value R version 3.5.1. David [[alternative HTML version deleted]]
2001 Jan 17
1
Scientific notation?
Hi, Would there be a function and/or some options to force R to write a value of say 1.0e-4 as "0.0001"? More specifically I want to use R to write ASCII file(s) for other programs to read and some of these programs don't know how to deal numbers in scientific notation or have a different convention. Thanks in advance. Yves Gauvreau B.E.F.P. Universit? du Qu?bec ? Montr?al cyg at
2006 Nov 17
2
Numbers with correct significant digits
This, for example: v <- c(9.6996, 99.99) formatC(v, digits=3, format="g") shows: " 9.7" " 100" This is scientifically incorrect for the first number in the sense that I like to show all 3 significant digits, including trailing zero's. Is there a way that the first number would show as " 9.70"? By the way, can't use format() since it applies
2006 Sep 14
1
hist for two sets
A quick question, please. x = c(0.0001, 0.0059, 0.0855, 0.9082) y = c(0.54, 0.813, 0.379, 0.35) where A = 1st set, B = 2nd set, C = 3rd set, D = 4th set respectivley. How do you make hist plot side by side for x & y? i.e. 0.0001 and then to the right 0.54, 0.0059 and then to the right 0.813, etc. thx much [[alternative HTML version deleted]]
2006 Mar 26
1
voice delay after pause speaking
I am using speex in a voip project.I use an ARM 9 based cpu. all is ok but on problem exists. after I pause my speaking a while, for example, 2 minutes, the other peer hearsthe voice delay. I have made many test to lookup its reason, it\'s seems that decode process needs more CPU power in this case. I use mono 8KHz , encoding without VAD and preprocessor. who can tell me how to adjust some
2008 Jun 06
2
Why doesn't formatC( x, digits=2, format="g") doesn't always give 2 sig figs?
Hi all I am not a C programmer, but I am trying to understand formatC to get consistent printing of reals to a given number of significant digits. Can someone please explain this to me? These first three give what I expect on reading ?formatC: > formatC(0.0059999, digits=2,format="fg",flag="#") [1] "0.0060" > formatC(0.59999,
2003 Feb 21
1
how to turn axis labels for trellis/dotplot
hi, it occurs quite naturally that groupnames have so many characters that they overlap as horizontally printed labels for the xaxis in a dotplot. is it possible to turn ('par(las=1)') the (x)axis-labels in a dotplot? in general, is it possible to add new customization themes to trellis.get()? any solution is very welcome! tomy -- no signature
2006 Dec 09
2
Floating point maths in R
Hi, I am not sure if this is just me using R (R-2.3.1 and R-2.4.0) in the wrong way or if there is a more serious bug. I was having problems getting some calculations to add up so I ran the following tests: > (2.34567 - 2.00000) == 0.34567 <------- should be true [1] FALSE > (2.23-2.00) == 0.23 <------- should be true [1] FALSE > 4-2==2 [1] TRUE > (4-2)==2 [1] TRUE >
2010 Aug 16
4
print numbers
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? Thanks John
2008 Jun 09
1
Bug/Error in formatC? (Was: Why doesn't formatC( x, digits=2, format= "g")...)
Hi all After posting what follows, Duncan Murdoch suggested perhaps a bug in formatC, or an error on documentation. Any comments? In particular, bug, error or not, any ideas about how I can consistently get two significant figures to print? P. ---------- Original Message ---------- Hi all I am not a C programmer, but I am trying to understand formatC to get consistent printing of
2008 Apr 04
4
Arbitrary Precision Numbers
Hi (If you're wondering, this is a Project Euler question :)) If I wanted to calculate the sum of the digits in the decimal representation of 2^1000, what would be a good way to go about that? I've tried the following methods: # Calculate the sum of digits in the decimal representation of 2^n # Only works for smaller values of n bsum <- function(n) { s <- 0 e <-
2002 Jul 03
2
Scientific notation
I'm writing a load of output to a file using cat(...), but I can't work out how to turn off scientific notation for small numbers. When I originally tried this a while a go I ended up building up a string variable, which is rather clumsy... Many thanks, David -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2011 May 08
2
Pretty printing numbers
Friends I am trying to format a number to a string so 2189.745 goes to "2,189.35" and 309283.929 goes to "309,283.93" I have tried to use formatC(X, big.mark=",",drop0trailing=FALSE, format="f") but it does not get the number of decimals correct. Specifying digits does not work as that is significant digits. I could use a switch statement switching on
2010 Apr 28
2
unexpected result from format(x, digits)
Is this a bug somewhere? The format function, using a specific number of digits, doesn't give sensible results: R> set.seed(2);print(x<-rexp(5)) [1] 1.86535 0.40475 0.14665 1.73071 0.08953 R> format(x,digits=1) [1] "1.87" "0.40" "0.15" "1.73" "0.09" R> format(x,digits=2) [1] "1.87" "0.40" "0.15"