Displaying 20 results from an estimated 4000 matches similar to: "base::format adds extraneous whitespace for some inputs"
2019 Jun 20
0
base::format adds extraneous whitespace for some inputs
I can reproduce this.
It has to do with whether the value rounds down to 9 or up to 10, and
thus needs another space, I think. I agree that it shouldn't happen,
but at least you can get rid of the space by using trim = TRUE.
# rounds to 9 vs 10
format(9.95, digits = 2)
format(9.96, digits = 2)
format(9.95, digits = 2, nsmall = 2)
format(9.96, digits = 2, nsmall = 2)
format(9.95, digits =
2013 Sep 17
1
[PATCH] [Portable] Prune extraneous whitespace in sshd_config
The sshd_config file shipped with OpenSSH Portable 6.3p1 (and several
earlier versions as well) contains an extra space at the end of lines
87 and 88. The attached patch corrects this.
Jason
2004 Mar 03
3
Adding text (coefts) to pairs panels
Hi,
First of all, thanks for the efforts of all the developers and contributors
- I'm very new to R and at the moment am just using it to create some
graphics, but it seems to be quite powerful.
I've googled the archives and wasn't able to find anyhting that dealt with
this problem, so would appreciate any suggestions/tips.
In a pairs plot I'd like to plot a linear regression line
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"
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 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 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,
2005 Nov 17
1
Problem with fitdistr for gamma in R 2.2.0
Dear R developers,
I have encountered strange behaviour of fitdistr for gamma in recent R
build i.e. 2.2.0. I have attached the code for data at the end of this mail
so you can reproduce the problem. In short, I am able to run fitdistr under
2.1.0 without problems, while I get the following error under 2.2.0
(Version 2.2.0 Patched (2005-11-15 r36348))
> fitdistr(otm, "gamma")
Error
2011 Feb 26
2
how to remove rows in which 2 or more observations are smaller than a given threshold?
Hello
The data set I am examining has 7425 observations (rows with unique
identifiers) and 46 samples(columns).
I have been trying to generate a dataset that filters out observations
that are "negligible"
The definition of "negligible" is absolute value less or equal to 1.58.
The rule that I would like to adopt to create a new data is: drop rows
in which 2 or more
2001 Sep 25
2
glm.nb, anova.negbin
Dear R-collegues,
I'm getting an error message (Error in round) when summarising a glm.nb
model, and when using anova.negbin (in R 1.3.1 for windows):
> m.nb <- glm.nb(tax ~ areal)
> m.bn
Call: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498,
link = log)
Coefficients:
(Intercept) areal
3.03146 0.03182
Degrees of Freedom: 283 Total (i.e. Null); 282
2012 Apr 14
1
R Error/Warning Messages with library(MASS) using glm.
Hi there,
I have been having trouble running negative binomial regression (glm.nb)
using library MASS in R v2.15.0 on Mac OSX.
I am running multiple models on the variables influencing the group size of
damselfish in coral reefs (count data). For total group size and two of my
species, glm.nb is working great to deal with overdispersion in my count
data. For two of my species, I am getting a
2006 May 01
1
format.info() versus format.default(): Comments please
The format.info() function currently takes args (x, digits = NULL,
nsmall = 0), while format.default() takes many more:
function (x, trim = FALSE, digits = NULL, nsmall = 0, justify = c("left",
"right", "centre", "none"), width = NULL, na.encode = TRUE,
scientific = NA, big.mark = "", big.interval = 3, small.mark = "",
2007 Jun 08
2
legend + expression
Dear all;
A simple? question.
I'm having a problem with a math expression in the legend of a plot
and I haven't found the way to get this to work, so any help will be
appreciate. Basically I want to include in the plot is the R-squared
and its numerical value, so I tried this:
R2c<-0.82879 # R-squared of calibration model
plot(1:10,1:10)
legend("topleft",
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"
>
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.
2007 Jun 13
5
Confusion with sapply
Hi,
I have some confusion in applying a function over a column.
Here's my function. I just need to shift non-March month-ends to March
month-ends. Initially I tried seq.dates, but one cannot give a negative
increment (decrement) here.
return(as.Date(seq.dates(format(xdate,"%m/%d/%Y"),by="months",len=4)[4])
)
Hence this simple function:
> mydate <-
2009 May 20
2
round function seems to produce maximum 2 decimals
I am trying to use round()to force R to display a specific number of
decimals, but it seems to display <=2 decimals no matter what I specify in
the digits argument. As an alternative I tried signif(), but it also
produces unexpected results. See example code and results below. Format()
works, but then the result no longer is numeric. Am I missing something
simple?
I am using R 2.9.0 on Windows
2017 Jul 25
1
Can rsync server mark deleted source files as extraneous?
rsync --delete option tells rsync to delete extraneous files from the receiving side (ones that aren't on the sending side).But if a user accidentally deletes a file, there is no way to restore it from the server.If --delete option is not used, and the local hard disk is destroyed, restored data will include old deleted files.
Is there a way for rsync server to retain backup of deleted source
2007 Mar 08
2
curve of density on histogram
Hi R users,
I would like to know why these following curve densities don't appear
correctly on the histograms.
Thank you for your help
library(lattice)
library(grid)
resp <- rnorm(2000)
group <- sample(c("G1", "G2", "G3", "G4"), replace = TRUE, size = 1000)
histogram(~ resp | group, col="steelblue",
panel = function(x, ...){
std
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 =