similar to: "digits" in round()

Displaying 20 results from an estimated 20000 matches similar to: ""digits" in round()"

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 Oct 11
2
R vs SPSS contrasts
Hi Folks, I'm comparing some output from R with output from SPSS. The coefficients of the independent variables (which are all factors, each at 2 levels) are identical. However, R's Intercept (using default contr.treatment) differs from SPSS's 'constant'. It seems that the contrasts were set in SPSS using /CONTRAST (varname)=Simple(1) I can get R's Intercept to match
2008 Mar 12
1
[follow-up] "Longitudinal" with binary covariates and outcome
Hi again! Following up my previous posting below (to which no response as yet), I have located a report which situates this type of question in a longitudinal modelling context. http://www4.stat.ncsu.edu/~dzhang2/paper/glm.ps Generalized Linear Models with Longitudinal Covariates Daowen Zhang & Xihong Lin (This work seems to originally date from around 1999). They consider an outcome Y,
2005 Sep 29
2
Select varying LS digits in long numbers?
Hi Folks, I'm trying to find a neat solution to an apparently simple problem, but one which turns out to be a bit more intricate and tricky than one might expect. Suppose I have numbers given to a large number of digits. For example 1234567021 where (though I don't know this beforehand) only the last 3 digits will be varying (and all 3 will vary). What I want is, give a vector x of
2006 Aug 22
1
summary(lm ... conrasts=...)
Hi Folks, I've encountered something I hadn't been consciously aware of previously, and I'm wondering what the explanation might be. In (on another list) using R to demonstrate the difference between different contrasts in 'lm' I set up an example where Y is sampled from three different normal distributions according to the levels ("A","B","C")
2012 Mar 04
1
rpart package, text function, and round of class counts
I run the following code: library(rpart) data(kyphosis) fit <- rpart(Kyphosis ~ ., data=kyphosis) plot(fit) text(fit, use.n=TRUE) The text labels represent the count of each class at the leaf node. Unfortunately, the numbers are rounded and in scientific notation rather than the exact number of examples sorted by that node in each class. The plot is supposed to look like
2008 Oct 20
3
? extended rep()
Hi Folks, I'm wondering if there's a compact way to achieve the following. The "dream" is that, by analogy with rep(c(0,1),times=c(3,4)) # [1] 0 0 0 1 1 1 1 one could write rep(c(0,1),times=c(3,4,5,6)) which would produce # [1] 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 in effect "recycling" x through 'times'. The objective is to produce a vector of
2008 May 29
1
Help for R on Windows for non-Win-enabled!
Hi Folks, I need help with a query about R on Windows, specifically about graphics devices. I'm advising someone remotely (so it's all by email) who is running R on Windows, while I am not (Linux only). Things have reached the stage where saving graphics plots as Windows metafiles is looming. I've been told that the result of "?device" in Windows is as follows (which is
2009 Feb 05
3
"open-ended" plot limits?
Hi Folks, Maybe I've missed it already being available somehow, but if the following isn't available I'd like to suggest it. If you're happy to let plot() choose its own limits, then of course plot(x,y) will do it. If you know what limits you want, then plot(x,y,xlim=c(x0,x1),ylim(y0,y1) will do it. But sometimes one would like to a) make sure that (e.g.) the y-axis has a
2002 May 16
1
Tps
Hi, I have a 4 column file (long/lat/elev/variable) and I tried to fit the values of my variable to the XYZ space using Tps and I keep getting the following message: Warning messages: 1: GCV search gives a minumum at the endpoints of the grid search in: Krig.find.gcvmin(info, lambda.grid, gcv.grid$GCV, Krig.fgcv, 2: GCV search gives a minumum at the endpoints of the grid search in:
2008 Oct 12
1
png(): Linux vs Windows
Hi Folks, Quick question. I have the following line in an R code file which runs fine on Linux: if(PNG) png(GraphName,width=12,height=15,units="cm",res=200) I learn that, when the same code was run on a Windows machine, there was the following error: Error in png(GraphName,width=12,height=15,units="cm",res=200): unused argument(s) (units = "cm") Sorry to
2009 May 17
2
Output of binary representation
I am interested in studying the binary representation of numerics (doubles) in R, so am looking for possibilities of output of the internal binary representations. sprintf() with format "a" or "A" is halfway there: sprintf("%A",pi) # [1] "0X1.921FB54442D18P+1" but it is in hex. The following illustrate the sort of thing I want: 1.1001 0010 0001 1111
2008 May 20
1
contr.treatments query
Hi Folks, I'm a bit puzzled by the following (example): N<-factor(sample(c(1,2,3),1000,replace=TRUE)) unique(N) # [1] 3 2 1 # Levels: 1 2 3 So far so good. Now: contrasts(N)<-contr.treatment(3, base=1, contrasts=FALSE) contrasts(N) # 1 2 # 1 1 0 # 2 0 1 # 3 0 0 whereas: contr.treatment(3, base=1, contrasts=FALSE) # 1 2 3 # 1 1 0 0 # 2 0 1 0 # 3 0 0 1 contr.treatment(3, base=1,
2009 Sep 01
2
Function for all 2^N subsets of N
Greetings all! I have been searching the Site for a function, say "subsets", such that for instance subsets(10) would return a (say) matrix of indices to the 2^10 subsets of N items -- perhaps in the form of 2^10 rows each of which is 10 entries each either TRUE or FALSE. Or 1 or 0. Or ... I can of course write my own, using good old looping technology or similar, but it would be
2009 Jul 23
1
error message: .Random.seed is not an integer vector but
Thanks much Ted. I actually had just tried what you suggest here before you posted, and resolved the problem. Thanks also for the other tips. I wrote x = as.vector(c(1:12)) because I thought that the mode of x might be the problem, the error message pointing to .Random.seed notwithstanding. On a related note, I did a brief test a couple weeks back where I ran a million random samples of 3 from
2008 Apr 27
2
Deb-4.0 Etch and sources.list for R
Hi Folks, I'm running Debian-4.0 Etch, installed last September from a DVD, and regularly updated as things arise. I have R version 2.4.0 Patched (2006-11-25 r39997) installed (initially at the time of first installation of Debian, as provided by Debian), along with a variety of packages. I'd like to be able to connect to the CRAN repositories for Debian R, for updates etc. When I visit
2010 May 12
6
A primitive OO in R -- where next?
Greetings All, Out of curiosity, I've just done a very primitive experiment: Obj <- list(Fun=sum, Dat=c(1,2,3,4)) Obj$Fun(Obj$Dat) # [1] 10 That sort of thing (much more sophisticated) must be documented mind-blowingly somewhere. Where? Where I stand right now: The above (and its immediately obvious generalisations, like Obj$Fun<-cos) is all I know about it so far. Ted.
2008 Jun 01
2
Eliminating "[...]" from print
Hi Folks, This must be easy but I've not managed to locate the solution! Basically: I'm using sink() to save successively obtained results, e.g. I construct a set of regression coefficients etc. with names rows and columne (I want to see the names in the output) as an object (say "Object"), and then I emit it with print(Object) So far so good. But I also want to print a
2009 Oct 22
1
contour() & contourLines()
Hi Folks, I have been using contour() to produce some contour plots (of a spatially-smooted density produced by kde2d()), with very satisfactory results. I now want access to the coordinates of the points on the contours, and it would seem that contour() does not return a value, so there is nothing from which these could be extracted. However, apparently contourLines() does, and it seems to be
2007 Dec 09
2
Adding info from summary(lm(...)) to plot
Hi Folks, Say I have 2 continuous variables X,Y. I can of course plot (X,Y) with plot(X,Y,pch="+",col="blue") say, and add the regression line from lm(Y~X) by extracting the coefficients 'a' of Intercept and 'b' of X from Y.lm <- lm(Y~X). Now, however, I want to have not only a general explanatory title such as main="Plot of Y against X"