Displaying 20 results from an estimated 20000 matches similar to: "format.info() versus format.default(): Comments please"
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
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,
2009 Nov 13
2
format (PR#14062)
Full_Name: Dirk Jacob
Version: R 2.8.1 and 2.9.1
OS: Win XP
Submission from: (NULL) (153.96.32.62)
I want to convert numbers to strings
like:
> inputs= c(0.3+0*(1:12) )
> (format(inputs,digits=3,scientific=T,collapse=" "))
and it works
[1] "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01"
2008 Aug 07
1
Bug in format.default(): na.encode does not have any effect for (PR#12318)
Hi!
If I use format() on numeric vector, na.encode argument does not have any e=
ffect. This
was reported before:
- https://stat.ethz.ch/pipermail/r-help/2007-October/143881.html
- http://tolstoy.newcastle.edu.au/R/e2/devel/06/09/0360.html
It works for other (say character) classes!
> format(c("a", NA), na.encode=3DTRUE)
[1] "a " "NA"
>
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()
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
2006 Feb 14
1
weird behavior of nsmall in format
>From the help page of format, nsmall should control the number of digits.
> format(0.123456789, nsmall = 10)
[1] "0.1234567890"
> format(0.123456789, nsmall = 1)
[1] "0.1234568"
> format(0.123456789, nsmall = 2)
[1] "0.1234568"
> format(0.123456789, nsmall = 8)
[1] "0.12345679"
It adds zeros fine but for
2006 Dec 13
2
exporting a table to latex
Hi
I am using the latex() command from the Hmisc package to export table
to latex. For formating of the values, I use the format() function. But
I don't manage to get the format of the values right: I don't want
scientific notation, but if I say scientific=FALSE, I get many digits
after the decimal point which I can not control with digits=... and
nsmall=... in the format command.
2003 May 02
2
Suppressing Scientific Notation
R gurus,
Every so often(*) someone asks how to suppress scientific notation in
printing, so I thought I'd give it a shot, but I need some help.
The formatting decision is made(**) on line 286 of src/main/format.c :
if (mF <= *m) { /* IFF it needs less space : "F" (Fixpoint) format */
where mF is the number of characters for "normal" printing and *m is the number
2006 Oct 16
6
NULL or NA for missing function arguments?
Hi,
I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.
In the R code that I have looked at, it seems that both forms are used
(NULL seems to be used more often though). Sometimes both variants are
in the same declaration, e.g.
format.default <-
function(x, trim = FALSE, digits = NULL, nsmall = 0,
justify = c("left",
2006 Jun 09
4
HTML nsmall vector format problem
Hello All
I am having a bit of trouble formatting my HTML with the desired number
of digits after the decimal place. Am I doing something
wrong/misunderstanding or is it a bug?
Looking at the example supplied with ?HTML.data.frame:
HTML(iris[1:2,1:2],nsmall=c(3,1),file="")
Gives html output that includes the lines:
</tr> <tr><td
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
2009 Aug 12
2
R numeric string problem
Hi,
I have a text (.dat) file, in which each row contains several long numeric
strings. One of the strings is 38 digits long, for example:
03200801200801172008011720092904008901
When I read in the data file, this string shows up as 3.200801e+36. To get
rid of the scientific notation, I used "options(scipen=999)." When I did
this, the scientific notation went away, but the numeric
2010 Aug 27
3
interpreting date-related error message
Hello, helpeRs,
I have a vector of numbers from 1-365 (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,
2010 Nov 19
1
Option to Print with numbers formatted
Hello group,
I have a data frame called test.df with a bunch of columns.
When I do a print(test.df), I want the numbers to appear a pre-defined
setting.
I believe this can be achieved by sprintf but this needs to be done
individually for the data.
However, is there an option that I can set so that all numerical values
default to comma separated, 2 decimal places when they appear?
Thanks,
S
2008 Aug 14
1
Format with n significant figures / digits
Hi everyone,
I can't figure out how to format numbers to have a certain number of
significant figures (as opposed to decimal places) without using
scientific notation and including trailing zeros if necessary.
e.g. I would like to achieve the following:
0.800001 ---> 0.8000
123.4567 ---> 123.4
0.1234567 ---> 0.1234
7.654321 ---> 7.654
7654321 --->
2008 Feb 26
4
numeric format
Hi!
I'm an R newbie and this should be a trivial problem, but I can't make it
work and cannot find what I'm doing wrong in the literature.
I entered the the command:
table<-data.frame(x, scientific=F, digits=4)
table
This prints a column of x with 16 useless decimal places after the decimal
point. Also, it prints an unwanted index number (1-20) in the left column.
How do I get rid
2008 Jun 02
6
significant digits (PR#9682)
I came to report this same bug and found it already in the trash, but
I slightly disagree with that assessment. If it's not a bug, then
perhaps it's a feature request. Comments at the end.
On Mon, May 14, 2007, Duncan Murdoch wrote:
>>On 13/05/2007 8:46 PM, scott.wilkinson at csiro.au wrote:
>>
>> In the example below round() does not report to the specified number of
2010 Feb 14
4
Newbie woes with *apply
Dataframe cust has Date-type column open.date. I wish to set up another
column, with (first day of) the quarter of open.date.
To be comprehensive (of course, improvement suggestions are welcome),
month = function(date)
{
return(as.numeric(format(date,"%m")))
}
first.day.of.month = function(date)
{
return(date + 1 - as.numeric(format(date,"%d")))
}
first.day.of.quarter =
2009 Jun 11
2
How to force R to print 2 decimal places in column of a data.frame?
How to force R to print 2 decimal places in column of a data.frame? I tried to do so:
x = inp(format(rounf(inp$Tamanho, 2), nsmall = 2),)
where "INP" is data.frame and "Size" is the name of column. But has error:
Error in eval.with.vis(expr, envir, enclos) :
could not find function "inp"
Lesandro
Veja quais s?o os assuntos do momento no Yahoo! +Buscados