Displaying 20 results from an estimated 10000 matches similar to: "small bug in formatC?"
2009 Jan 27
1
small bug in base::formatC (PR#13474)
Full_Name: Bernd Bischl
Version: 2.8.1
OS: Windows XP Professional
Submission from: (NULL) (129.217.207.95)
Hi,
there seems to be a small bug in formatC:
formatC("foo", format="s", mode="charcacter")
Error in formatC("foo", format = "s", mode = "charcacter") :
'mode' must be "double" ("real") or
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
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
2012 Feb 23
3
I'm sure I'm missing something with formatC() or sprintf()
I have a four-digit string I want to convert to five digits. Take the
following frame:
zip
2108
60321
60321
22030
91910
I need row 1 to read '02108'. This forum directed me to formatC previously
(thanks!) That usually works but, for some reason, it's not in this
instance. Neither of the syntaxes below change '2108' to '02108.' The values
in cand_receipts[,1] are of
2001 Oct 26
1
Bug or new concept in formatC?
As a sequel to my previous mail on cut, formatC does not produce
what I have been taught is significant digits:
> x <- c(1.0793,1.0796, 11.0954, 11.0736 )
> formatC(x,digits=3,format="g")
[1] "1.08" "1.08" "11.1" "11.1"
(3,3,3,3) significant digits OK
> formatC(x,digits=3,format="f")
[1] "1.079"
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,
2002 Mar 13
1
Commas in formatC
formatC() is great for formatting numbers! But it would be even better if it
could optionally insert commas (or semicolons), e.g.
R> formatC(1234567.89, digits=2, format="f", commas=T)
[1] "1,234,567.89"
Here's a snippet of code that does that, which could more or less just be
inserted into at the end of formatC if any R-core guru were so inclined. "r"
2005 Nov 22
2
(PR#8337) formatC adds leading space -- on some Windoze
>>>>> "KevinW" == Kevin Wright <kwright68 at gmail.com>
>>>>> on Mon, 21 Nov 2005 18:13:36 +0100 (CET) writes:
KevinW> Full_Name: Kevin Wright
KevinW> Version: 2.2.0
KevinW> OS: Windows 2000
^^^^^^^
this must be part of the problem
KevinW> Submission from: (NULL) (170.54.58.4)
KevinW> Apologies if
2003 Feb 24
2
printing decimal numbers
hi,
this is a very basic question -- sorry for posing it:
how can i force R to print 0.0001 instead of 1e-04???
.--------------------.
| > 0.0001 |
| [1] 1e-04 |
`--------------------'
i tried the functions format, formatC, ... and changed
options()$digits with no success!
thanks for advice,
tomy
--
no signature
2015 Aug 10
2
Bug or expected behavior of APFloat class?
Hi,
I've been playing around with the APFloat class lately and I came
across behavior I was not expecting based on reading the
implementation comments and I'm wondering if it's a bug or
intentional.
The behavior concerns converting an APFloat to a string and back
again. In the implementation of ``APFloat::toString(...)`` you can
specify ``FormatPrecision`` as 0. The method comments
2016 Jun 01
2
segfault / crash when asking for large memory via strrep()
We've had this more general topic on R-help, and also in R-devel recently.
There's one case here where I get the feeling R never gets into
swapping but more directly aborts possibly from a bug we can
more easily fix.
Today I've been working (successfully! - not yet committed) at
fixing str() for very large strings.
In this process, I've found that
pc <- function(.)
2006 Jan 23
1
formatC slow? (or how can I make this function faster?
I'm trying to convert a matrix of capture occasions to format that an
external program can read. The job is to basically take a row of
matrix, like
> smp[1,]
[1] 1 1 0 1 1 1 0 0 0 0
and convert it to the equivalent string "1101110000"
I'm having problems doing this in a speedy way. The simplest solution
(calc_history below, using apply, paste and collapse) takes about 2
2000 Jan 04
0
formatC (bug and fix) (PR#394)
OK:
> formatC(as.double(c(1,0,NA)))
[1] "1" "0" "NA"
NOT OK:
> formatC(as.integer(c(1,0,NA)))
[1] "0" "1072693248" "NA"
> formatC(as.integer(c(0,1,NA)))
[1] "0" "0" "NA"
BUG TRACED TO R-code of formatC()
where
x[!Ok] <- 0
unintendedly changes the storage.mode of x to
2005 Feb 11
3
formatC with illegal input crashes Rgui (PR#7686)
Full_Name: Peter Ehlers
Version: rw2001pat (2005-02-03)
OS: Win XP
Submission from: (NULL) (136.159.61.115)
formatC(1, flag="s") crashes Rgui.
Similarly for flag=[SnZ].
Stupid input, of course, but I'm error-prone.
Peter
1999 Feb 28
0
Formatting in formatC and format (PR#129)
[This turned into a bug report which will go to r-devel, so I have taken it
off r-help.]
Bugs reported here:
(1) formatC's help page need some clarification.
(2) formatC needs to treat modes "double" and "real" as equivalent.
(3) format's help page or (preferably) format needs correction re the
meaning of `digits'
On Sun, 28 Feb 1999, Martin Maechler wrote:
2008 May 12
5
Format integer
Hi,
What's one way to convert an integer to a string with preceding 0's?
such that
'13' becomes '00000000013'
to be put into a string
I've tried formatC, but they removes all the zeros and replace it with
blanks
Thanks
--
Regards,
Anh Tran
[[alternative HTML version deleted]]
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 May 25
0
documented/undocumented behavior of as.double(formatC(x, digits=17))
Some days ago, there was a discussion about the command
formatC(exp(1),digits=100,width=-1)
Converting a double value to a string, from which the double may be
reconstructed exactly, may be useful. So, I did some experimentation
with it in my linux installation of R-2.5.0.
I generated a vector x of a large number of random doubles (random sign,
random mantissa with 53 significant bits and
2008 Oct 17
2
Beginner's question: number formatting
Hello R-helpers,
I have a problem with formatting a single number to show leading zeros.
For example, I want "2" displayed 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
2000 Jan 12
0
inconsistencies between formatC(), format() and format.char()
Dear R-Developers,
Just a note: there are some inconsistencies between formatC(), format() and
format.char() and cross calling between these functions.
On the one hand
> cat(format('{"}'), "\n")
{\"}
> cat(format.char('{"}'), "\n")
{\"}
is by default format.char(, flag="-") and thus by default calling format()
>