search for: prettynum

Displaying 20 results from an estimated 48 matches for "prettynum".

2019 Mar 21
3
prettyNum digits=0 not compatible with scientific notation
R developers, Seems I get a bad result ("%#4.0-1e" in particular) when trying to use prettyNum digits=0 with scientific notation. I tried on both my Linux box and on an online R evaluator and saw the same problem, so it's not limited to my box at least. I see the problem in both R 3.5.3 and R 3.3.2. options(scipen=-100) prettyNum(1, digits=0) [1] "%#4.0-1e" prettyNum(2, digits...
2019 Mar 22
2
prettyNum digits=0 not compatible with scientific notation
FWIW, it doesn't seem to be happening on Mac OS: > format(2^30, digits=0) [1] "1.e+09" > prettyNum(12345.6, digits=0) [1] "1.e+04" A glibc misfeature? -pd > On 22 Mar 2019, at 10:10 , Martin Maechler <maechler at stat.math.ethz.ch> wrote: > > Thank you, Robert for raising this here ! > >>>>>> Robert McGehee >>>>>> on Thu, 2...
2019 Mar 22
0
prettyNum digits=0 not compatible with scientific notation
Thank you, Robert for raising this here ! >>>>> Robert McGehee >>>>> on Thu, 21 Mar 2019 20:56:19 +0000 writes: > R developers, > Seems I get a bad result ("%#4.0-1e" in particular) when trying to use prettyNum digits=0 with scientific notation. I tried on both my Linux box and on an online R evaluator and saw the same problem, so it's not limited to my box at least. I see the problem in both R 3.5.3 and R 3.3.2. > options(scipen= -100) The above is extreme: You're basically setting an op...
2019 Mar 22
0
prettyNum digits=0 not compatible with scientific notation
>>>>> peter dalgaard >>>>> on Fri, 22 Mar 2019 17:30:19 +0100 writes: > FWIW, it doesn't seem to be happening on Mac OS: >> format(2^30, digits=0) > [1] "1.e+09" >> prettyNum(12345.6, digits=0) > [1] "1.e+04" > A glibc misfeature? It seems (and note we are talking about format.default() here, of which prettyNum() is only a wrapper in this case): Here's an example that shows that 'digits=0' actually can make "sense&quot...
2002 May 13
1
prettyNum inserts leading commas (PR#1548)
Under R-1.5.0 on Solaris 2.6: R> prettyNum(123456789, big.mark=",") [1] ",123,456,789" and that bad behavior (leading comma) spills into formatC as well: R> formatC(123456789, digits=0, format="f", big.mark=",") [1] ",123,456,789" Looks to me like a bug in src/library/base/R/form...
2018 May 25
4
options other than regex
...character with the character, followed by a decimal. The following big of regex works...and illustrates the reformatting I'm after: x <- '10110111' print(x) y <- sub("\\s+$", "", gsub('(.{1})', '\\1.', x)) print(y) I had a look at formatC or prettyNum as another way to get there from here, but couldn't get it to work: x <- '10110111' hold <- prettyNum(as.numeric(x), big.mark = ".", big.interval = 1, ??????? format = "d", flag = "0", width = nchar(x)) print(hold) I tried making big.mark a decim...
2008 Aug 07
1
Bug in format.default(): na.encode does not have any effect for (PR#12318)
...u/R/e2/devel/06/09/0360.html It works for other (say character) classes! > format(c("a", NA), na.encode=3DTRUE) [1] "a " "NA" > format(c("a", NA), na.encode=3DFALSE) [1] "a" NA I explored this a bit and found out that format.default() uses prettyNum(.I= nternal(format(...))) for formatting the logical, numeric, complex, ... classes. Simple tests (se= e bellow) show that .Internal(format()) does not obey the na.encode argument. ## Encode NA as "NA" > .Internal(format(x=3Dc(1, NA), trim=3DFALSE, digits=3DNULL, nsmall=3D0, w= idth=3...
2018 May 25
0
options other than regex
...a decimal. The following big of regex works...and > illustrates the reformatting I'm after: > > x <- '10110111' > print(x) > > y <- sub("\\s+$", "", gsub('(.{1})', '\\1.', x)) > print(y) > > I had a look at formatC or prettyNum as another way to get there from here, > but couldn't get it to work: > > x <- '10110111' > hold <- prettyNum(as.numeric(x), big.mark = ".", big.interval = 1, > format = "d", flag = "0", width = nchar(x)) > print(hold) >...
2019 Mar 22
1
prettyNum digits=0 not compatible with scientific notation
> On 22 Mar 2019, at 18:07 , Martin Maechler <maechler at stat.math.ethz.ch> wrote: > > gives (on Linux R 3.5.3, Fedora 28) > > d=10 d=7 d=2 d=1 d=0 > [1,] "123456" "123456" "123456" "1e+05" "%#4.0-1e" > [2,] "12345.6" "12345.6" "12346"
2009 Nov 13
2
format (PR#14062)
...c(840,1000,1000,1000) > R <- c(860,2500,2500,2000) > L <- c(0.23,1,1,1.1) > T <- c(0.2,0.2,0.3,0.175) > I <- c(0.05,0.1,0.14,0.18) > inputs <- cbind(C,R,L,T,I) If I try the same format command, it does not: > (format(c(inputs[1,]),digits=3, scientific=T)) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3, : invalid 'scientific' argument Only if I change scientific to NA > (format(c(inputs[1,]),digits=3, scientific=NA)) remark (not important for the problem): but I need scientific because sometimes the strings get to long otherwise...
2010 Dec 30
5
Why is format(10000, big.mark = "\\,") not 10\,000?
Hi, why does format(10000, big.mark = "\\,") not give me "10\,000"? How can I get this kind of "big.mark"? Cheers, Marius
2010 Aug 27
3
interpreting date-related error message
...(days of the year) that I would like to convert to a date. There are no NA's and no missing values. I did not insert leading zero's for numbers less than 100. Using the syntax: dat$doy.1 <- as.numeric(format(dat$doy, "%j" )) I get the following error message: Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : invalid 'trim' argument .What is the error message telling me? (Windows OS and R 2.11.1) Thank you. Toby
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 sure obvious, but I've spent the whole morning with it. Please help me! Thanks a lot, Tom
2008 Oct 17
2
Beginner's question: number formatting
...d as "002". My numbers have 1 to 3 digits and I would like them all to display 3 digits for printing. I know I could use "paste" in a loop with several "if"s, but I was wondering if there is a single function that can do this. I have tried "format", "prettyNum" and "formatC" back and forth, but these functions don't seem to be able to display leading zeros. Please help. -- Michal J. Figurski
2007 Jun 13
5
Confusion with sapply
...t;) > dc [1] "2006-01-01" "2006-02-01" "2006-03-01" "2006-04-01" "2006-05-01" "2006-06-01" "2006-07-01" "2006-08-01" [9] "2006-09-01" "2006-10-01" > sapply(as.vector(dc),Set2March) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3, : unimplemented type 'character' in 'asLogical' > What am I missing here? Shouldn't the function work with the sapply working on each entry? TIA and best, -Tir
2010 Feb 14
4
Newbie woes with *apply
...y(cust$open.date, FUN = first.day.of.quarter) Error in tapply(cust$open.date, FUN = first.day.of.quarter) : element 1 is empty; the part of the args list of 'is.list' being evaluated was: (INDEX) > cust$open.quarter = lapply(cust$open.date, FUN = first.day.of.quarter) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : invalid 'trim' argument Can anyone suggest the right syntax? Thank you. -- View this message in context: http://n4.nabble.com/Newbie-woes-with-apply-tp1555149p1555149.html Sent from the R help mailing list archive at Nabble.com.
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
2011 Feb 25
0
R 2.12.2 is released
...no longer raises an error when x contains solely non-finite values. (PR#14468) ? The plot.TukeyHSD() function now uses a line width of 0.5 for its reference lines rather than lwd = 0 (which caused problems for some PDF and PostScript viewers). ? The big.mark argument to prettyNum(), format(), etc. was inserted reversed if it was more than one character long. ? R CMD check failed to check the filenames under man for Windows' reserved names. ? The "Date" and "POSIXt" methods for seq() could overshoot when to was supplied and...
2011 Feb 25
0
R 2.12.2 is released
...no longer raises an error when x contains solely non-finite values. (PR#14468) ? The plot.TukeyHSD() function now uses a line width of 0.5 for its reference lines rather than lwd = 0 (which caused problems for some PDF and PostScript viewers). ? The big.mark argument to prettyNum(), format(), etc. was inserted reversed if it was more than one character long. ? R CMD check failed to check the filenames under man for Windows' reserved names. ? The "Date" and "POSIXt" methods for seq() could overshoot when to was supplied and...
2012 Apr 14
1
R Error/Warning Messages with library(MASS) using glm.
...? 1 (Dispersion parameter for Negative Binomial(61302.24) family taken to be 1) Null deviance: 1331.8 on 177 degrees of freedom Residual deviance: 641.1 on 171 degrees of freedom (3 observations deleted due to missingness) AIC: 729.44 Number of Fisher Scoring iterations: 1 Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : invalid 'nsmall' argument I am also getting this Error message for my other model for this species: > model1<-glm.nb(X...of.C..viridis~Depth+Coral.Species+Reef.Type+Depth*Coral.Species+Depth*Reef.Type+Coral.Species*Reef.Type...