search for: nsmall

Displaying 20 results from an estimated 67 matches for "nsmall".

Did you mean: small
2019 Jun 20
2
base::format adds extraneous whitespace for some inputs
Dear R Core Team, First of all, thank you for your amazing work on developing and maintaining this wonderful language. I just stumbled upon the following behavior in R version 3.6.0: format(9.91, digits = 2, nsmall = 2) format(9.99, digits = 2, nsmall = 2) yield "9.91" and " 9.99" with an extraneous whitespace. My expected output for the second command is "9.99". I have not found anything explaining the whitespace in the help files. Therefore, I am writing to report this beha...
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...
2019 Jun 20
0
base::format adds extraneous whitespace for some inputs
...s 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 = 2, nsmall = 2, trim=TRUE) format(9.96, digits = 2, nsmall = 2, trim=TRUE) # rounds to 99 vs 100 format(99.94, digits = 3) format(99.95, digits = 3) format(99.94, digits = 3, nsmall = 2) format(99.95, digits = 3, nsmall = 2) format...
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 class=firstcolumn>1</td><td class=cellinside>5.100</td><td class=cellinside>3.500</td></tr> <tr><td class=firstcolumn>2</td><td class=ce...
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
...ve Binomial(5.0883) family taken to be 1) Null deviance: 353.34 on 283 degrees of freedom Residual deviance: 293.34 on 282 degrees of freedom AIC: -2334394 Number of Fisher Scoring iterations: 1 Correlation of Coefficients: (Intercept) areal -0.9982 Error in round(x$theta, dp, nsmall = dp) : unused argument(s) (nsmall ...) > anova.negbin(m.nb) Error in get(x, envir, mode, inherits) : invalid first argument In addition: Warning message: tests made without re-estimating theta in: anova.negbin(m.nb) > Any suggestion of why I'm getting this error? Many thanks J...
2007 Jun 08
2
legend + expression
...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", legend=c(expression(R[c]^2==format(R2c,nsmall=2)))) Thanks for any hint PM
2009 May 20
2
round function seems to produce maximum 2 decimals
...nd 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 XP. Thanks, Glenn #code h=12345.16711 h round(h,digits=1) round(h,digits=2) round(h,digits=3) round(h,digits=4) round(h,digits=5) signif(h,digits=9) format(h,nsmall=4) #results > h=12345.16711 > h [1] 12345.17 > round(h,digits=1) [1] 12345.2 > round(h,digits=2) [1] 12345.17 > round(h,digits=3) [1] 12345.17 > round(h,digits=4) [1] 12345.17 > round(h,digits=5) [1] 12345.17 > signif(h,digits=9) [1] 12345.17 > > format(h,nsmall=4) [...
2004 Mar 03
3
Adding text (coefts) to pairs panels
...example(pairs), I have got this far: panel.myfitline<-function(x, y, digits=2, prefix="", cex.cor, ...) { res<-panel.smooth(x,y, col.smooth="blue", ...) reg <- coef(lm(y ~ x)) abline(coef=reg,untf=F) const<-format(reg[1], trim = FALSE, digits = NULL, nsmall = 0, justify = "left", ...) const<-paste(prefix, const, sep="") slope<-format(reg[2], trim = FALSE, digits = NULL, nsmall = 0, justify = "left", ...) slope<-paste(prefix, slope, sep="") if(missing(cex.cor)) cex <- 0.8/strwidth(cons...
2009 Nov 13
2
format (PR#14062)
...00,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 Now if I am trying the same thing as at...
2007 Mar 08
2
curve of density on histogram
...ttice) 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 <- if(length(x) > 0) format(round(sd(x), 2), nsmall = 2) else "NA" n <- length(x) m <- if(length(x) > 0) format(round(mean(x), 2), nsmall = 2) else "NA" panel.histogram(x, ...) panel.mathdensity(dmath = dnorm, col = "green", args = list(mean=mean(x),sd=sd(x)))...
2009 Nov 10
1
2 significant digits
...er ending with 0 with 2-significant digits? If I have for ex, 0.8031 and I use signif or round with digits = 2, I'll get 0.8. If I use format, I get character type (even if I pass number as parameter) and if I convert with as.numeric, I'll lose one significant digit (0): > format(13.7, nsmall = 2) [1] "13.70" > as.numeric( format(13.7, nsmall = 2)) [1] 13.7 Regards, Carol
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....
2012 Apr 14
1
R Error/Warning Messages with library(MASS) using glm.
...nomial(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) Error: no valid set of coefficients has...
2010 Aug 27
3
interpreting date-related error message
...nvert 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 Jun 05
3
Wilcoxon test output as a table
...W <- as.matrix(lapply(Dataset[2:11], function(x) wilcox.test(x ~ GrFac, alternative="two.sided", data=Dataset)$statistic)) P <- as.matrix(lapply(Dataset[2:11], function(x) wilcox.test(x ~ GrFac, alternative="two.sided", data=Dataset)$p.value)) W <- format(W, digits = 5, nsmall = 2) P <- format(P, digits = 1, nsmall = 3) Wnew <- matrix(paste(W), ncol=ncol(Dataset[2:11])) colnames(Wnew) <- paste(colnames(Dataset[2:11])) Wnew P This is the output (excerpt): > Wnew X1 X2 X3 X4 X5 X6 X7 X8 IA IV [1,] &q...
2008 Aug 07
1
Bug in format.default(): na.encode does not have any effect for (PR#12318)
...ault() 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=3DNULL, adj=3D1, na.encode=3DTRUE, scientific=3DNA)) [1] " 1" "NA" ## Do not encode NA as "NA" > .Internal(format(x=3Dc(1, NA), trim=3DFALSE, digits=3DNULL, nsmall=3D0, w= idth=3DNULL, adj=3D1, na.encode=3DFALSE, scientific=3DNA)) [1] " 1" &q...
2010 Nov 10
2
Decimal places in a function output
An embedded and charset-unspecified text was scrubbed... Name: n?o dispon?vel URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101110/9e098a24/attachment.pl>
2008 Aug 02
2
How to format the output file just the way I want ?
...9,55" quotes <- read.csv(textConnection(Lines), header=FALSE) x <- as.xts(quotes[,-(1:2)], as.POSIXct(paste(quotes[,1],quotes[,2]),format='%Y.%m.%d %H:%M')) colnames(x) <- c('Open','High','Low','Close','Volume') x write.table(format(x,nsmall=4), file = "K:\\OutputFile.csv", quote=FALSE, col.names=FALSE, row.names=format(index(x),"%Y.%m.%d,%H:%M"), sep=",") ____________________________________________________________
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 http://br.maisbuscados.yahoo.c...