Displaying 20 results from an estimated 3000 matches similar to: "Pretty printing numbers"
2019 May 30
1
Possible bug in formatC
I do not know if this is a bug or a case of improper documentation. The
documentation for formatC() implies that the difference between the options
format="f" and format="g" is that with "g", scientific format is sometimes
used. There is another difference between them that is not mentioned in the
documentation. drop0trailing=FALSE is ignored when format is set to
2025 May 23
1
Bug in prettyNum
? Fri, 23 May 2025 11:47:33 +0000
Marttila Mikko via R-devel <r-devel at r-project.org> ?????:
> When called with a numeric vector, the `replace.zero` argument is
> disregarded.
>
> > prettyNum(0, zero.print = "- ", replace.zero = TRUE)
> [1] "-"
> Warning message:
> In .format.zeros(x, zero.print, replace = replace.zero) :
>
2025 May 23
1
Bug in prettyNum
Dear list,
I'd like to report a bug in `prettyNum()`. When called with a numeric vector, the `replace.zero` argument is disregarded.
> prettyNum(0, zero.print = "- ", replace.zero = TRUE)
[1] "-"
Warning message:
In .format.zeros(x, zero.print, replace = replace.zero) :
'zero.print' is truncated to fit into formatted zeros; consider 'replace=TRUE'
A
2025 May 26
1
Bug in prettyNum
Thank you, Marttila and Ivan,
As the original author of prettyNum() {etc ..},
I will commit such a bug fix to R-devel (and probably port it to
R 4.5.0 patched) quite soon
(but not yet today).
Best regards,
Martin Maechler
>>>>> Ivan Krylov via R-devel
>>>>> on Fri, 23 May 2025 17:14:57 +0300 writes:
> ? Fri, 23 May 2025 11:47:33 +0000
>
2025 May 27
1
Bug in prettyNum
Thanks for the contribution Mikko!
For testing future patches, you can actually do it right in the web
browser, thanks to Heather Turner's R Dev Container, see instructions here
https://contributor.r-project.org/r-dev-env/container_setup/
Best
Toby
On Mon, May 26, 2025 at 6:28?PM Martin Maechler <maechler at stat.math.ethz.ch>
wrote:
> Thank you, Marttila and Ivan,
>
> As
2025 May 23
1
Formatting zeroes with prettyNum
Tim,
The purpose of the `replace.zero` argument is to allow longer replacements.
See for example the behaviour with a character vector input:
> prettyNum("0", zero.print = "- ", replace.zero = TRUE)
[1] "- "
I'm pretty sure this is a bug, and have now posted the relevant details on r-devel.
A fix would be below.
Best,
Mikko
diff --git
2010 Jul 01
2
Export data frame of high dimension to txt
I managed with success to export a data frame of 367 columns and 37 rows to a txt file, but unfortunately I couldn't manage the same with the transposed data frame. Specifically, it seems like the notebook cannot "read" correctly 367 columns, so it reads the first 145 columns and it folds down the rest of them and consequently it folds down the respective data.
2013 Mar 13
1
expression exponent labeling
Hi all,
I want to label an axis with exponents, but can't get it done with expression.
Any hints would be very welcome!
# simulated data, somewhat similarly distributed to my real data:
set.seed(12); d <- rbeta(1e6, 0.2,2)*150 ; d <- d[d>1e-8]
hist( d? , breaks=100)
# now on a logarithmically scaled axis:
hist(log10(d), breaks=100, xaxt="n")
abline(v=
2004 Mar 21
2
formated output
Hi all;
I need to create ASCII files as output from R and I'm using sink(), cat(),
and paste() for this.
My problem is that the ASCII files hace several columns, and I would like to
know if intermediate columns (the second one for example) could be alineated
to the right. My values are integer ranging from 1 to 1000.
Thanks a lot.
Best regards,
Javier
2010 Jun 16
5
t-test problem
I have two pairs of related vectors
x1,y1
and
x2,y2
I wish to do a test for differences in means of x1 and y1, ditto x2 and y2.
I am getting odd results. I am not sure I am using 'pt' properly...
I have not included the raw vectors as they are long. I am interested if I
am using R properly...
> c(length(x1), length(y1), length(x2), length(y2))
[1] 3436 1619 2677 2378
First
2011 Nov 11
3
Why does length("") == 1?
It seems obvious to me that the empty string "" is length 0.
cheers
Worik
[[alternative HTML version deleted]]
2009 Sep 24
2
Date formats in as.Date
I have trouble with this:
as.Date("Sep-1981", format="%b-%Y")
Returns "NA"
>From documentation for strftime
'%b' Abbreviated month name in the current locale. (Also matches
full name on input.)
'%Y' Year with century.
What am I doing wrong?
cheers
Worik
[[alternative HTML version deleted]]
2025 May 23
1
Formatting zeroes with prettyNum
You fed it two characters, "dash" and "space" and it only wanted one character so it truncated to the first character and warned you that that's what it did.
If you had your space before the dash, it would have used that as your replacement character
> prettyNum(0, zero.print = " - ", replace = TRUE)
[1] " "
Warning message:
In .format.zeros(x,
2001 Apr 17
1
Pretty printing of frequency and other tables
I frequently use an S-Plus function print.char.matrix for
printing boxed tables. I use LaTeX even more frequently,
for which I (and Rich Heiberger) have a series of functions
that will be in the Hmisc library in R before too long.
[I have seen some other interesting functions for latex
already in R.] But it would still be nice to have
an equivalent of print.char.matrix in R for ordinary
2012 Nov 30
3
Line numbers with errors and warnings?
Is it possible to get a line number with an error report?
I have a long script and an error:
Error in `[.xts`(x, xsubset) : subscript out of bounds
It would be very helpful, and save a lot of time, if there was some
indication in the error message which line the error was.
I can find it using binary search but that is a painful process.
cheers
Worik
[[alternative HTML version deleted]]
2012 Oct 09
4
Modern Symbolic debugger for R programmes?
I think I am whistling in the wind, but is there a modern symbolic
debugger for R programmes?
I am working through some one else's code, thousands of lines, that
has the occasional bug in it, and a lot in my understanding of it.
I cannot make setBreakpoint or findLineNum work. I get "No source
refs found.". I am starting to loose my mind!
A debugger where I could set
2012 Mar 25
2
Weird POSIXct behaviour
Friends
I have an xts that I wish to access.
Browse[2]> DATA.ba[[p]]["2012-03-20 00:59:57","bid"]
bid
2012-03-20 00:59:57 1.4993
So far so good.
Now putting the index into a variable:
Browse[2]> Time
[1] "2012-03-20 00:59:57 NZDT"
Browse[2]> DATA.ba[[p]][Time, "bid"]
bid
Where has it gone?
Looking closer....
2010 Jun 08
2
Logical vector question
If I create a vector thusly
> v1 <- runif(20, min=0, max=1)
> v1
[1] 0.9754443 0.6306228 0.3238158 0.3175769 0.6791534 0.6956507 0.3840803
[8] 0.1421328 0.8592398 0.4388306 0.9472040 0.4727435 0.5645302 0.7391616
[15] 0.6116199 0.2727754 0.2657867 0.5261744 0.8764804 0.2032126
And I want to create a logical vector the same length that is true if v1<.3
or v1 > .7 how do I do it
2011 Dec 18
1
Looking for package 'rgp'
I am interested in the package 'rgp'
But....
> install.packages("rgp")
Installing package(s) into ‘/home/worik/R/x86_64-pc-linux-gnu-library/2.12’
(as ‘lib’ is unspecified)
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘rgp’ is not available
It is in cran: http://cran.r-project.org/web/packages/rgp/index.html
How do I install it?
2012 Nov 12
1
System problem: Sys.time() returns GMT, says NZDT
When I say:
> Sys.time()
[1] "2012-11-12 21:30:14 NZDT"
>
But that is not what my clock on the wall and my system say. Cannot show
you my clock but...
worik@lemy:/tmp$ date
Tue Nov 13 10:32:20 NZDT 2012
Sys.time() is returning GMT
$version.string
[1] "R version 2.14.1 (2011-12-22)"
> Sys.timezone()
[1] "NZDT"
>
I'm a little lost!
Worik