similar to: Strange behaviour of as.integer()

Displaying 20 results from an estimated 20000 matches similar to: "Strange behaviour of as.integer()"

2018 Aug 16
2
Xenial rpart package on CRAN built with wrong R version?
I manually downloaded the rpart package and installed it using dpkg, without removing the old rpart package first, and now everything works. During the installation, dpkg said: Unpacking r-cran-rpart (4.1-13-1cran1xenial0) over (4.1-13-1cran1xenial0) So again, it seemed that the new version had been installed, but it really wasn?t. I had no idea that something like this could happen. Huh.
2018 Aug 14
2
Xenial rpart package on CRAN built with wrong R version?
I?m not using the PPA, but the CRAN mirror from https://cran.r-project.org/bin/linux/ubuntu/#installation: deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ On 14 Aug 2018, at 12:25, George N. White III <gnwiii at gmail.com<mailto:gnwiii at gmail.com>> wrote: qOn Tue, 14 Aug 2018 at 05:04, Ulrich KELLER <ulrich.keller at uni.lu<mailto:ulrich.keller at
2018 Aug 14
2
Xenial rpart package on CRAN built with wrong R version?
Hello, I just upgraded my Ubuntu Xenial system to R 3.5.1 (from 3.4.?) by changing the sources.list entry and doing an "apt-get dist-upgrade". Everything works except loading the rpart package in R: > library(rpart) Error: package or namespace load failed for ?rpart?: package ?rpart? was installed by an R version with different internals; it needs to be reinstalled for use with
2007 Feb 24
3
gsub: replacing a.*a if no occurence of b in .*
I am trying to read a number of XML files using xmlTreeParse(). Unfortunately, some of them are malformed in a way that makes R crash. The problem is that closing tags are sometimes repeated like this: <tag>value1</tag><tag>value2</tag>some garbage</tag></tag><tag>value3</tag> I want to preprocess the contents of the XML file using gsub() before
2006 Sep 28
3
Evaluation of defaults in functions
Hello, and sorry if this is already explained somewhere. I couldn't find anything. R (2.3.1, Windows) seems to perform some kind of lazy evaluation when evaluating defaults in function calls that, at least for me, leads to unexpected results. Consider the following, seemingly equivalent functions: > foo1 <- function(x, y=x) { + x <- 0 + y + } > foo1(1) [1] 0 > foo2
2006 Jul 18
3
Test for equality of coefficients in multivariate multiple regression
Hello, suppose I have a multivariate multiple regression model such as the following: > DF<-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50)) > tmp<-rnorm(100) > DF$y1<-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5) > DF$y2<-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5) > x.mlm<-lm(cbind(y1,y2)~x1+x2,data=DF) > coef(x.mlm) y1 y2 (Intercept)
2005 Dec 22
2
bVar slot of lmer objects and standard errors
Hello, I am looking for a way to obtain standard errors for emprirical Bayes estimates of a model fitted with lmer (like the ones plotted on page 14 of the document available at http://www.eric.ed.gov/ERICDocs/data/ericdocs2/content_storage_01/0000000b/80/2b/b3/94.pdf). Harold Doran mentioned (http://tolstoy.newcastle.edu.au/~rking/R/help/05/08/10638.html) that the posterior modes' variances
2008 Sep 09
1
Addendum to wishlist bug report #10931 (factanal) (PR#12754)
--=-hiYzUeWcRJ/+kx41aPIZ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Hi, on March 10 I filed a wishlist bug report asking for the inclusion of some changes to factanal() and the associated print method. The changes were originally proposed by John Fox in 2005; they make print.factanal() display factor correlations if factanal() is called with rotation =
2008 Dec 08
2
Ubuntu 8.10: Package installation fails (lf77blas problem)
I just upgraded to Ubuntu 8.10 (i386) from 8.04. After the upgrade, I ran update.packages(.libPaths()[1]) in R to get the packages installed from source up to date too. Unfortunately, two packages could not be updated: mclust and mboost. In both cases, the error I got mentioned lf77blas. Here's the output for mboost: * Installing *source* package 'mboost' ... ** libs gcc -std=gnu99
2006 Nov 22
3
odd behaviour of %%?
Dear R Helpers, I am trying to extract the modulus from divisions by a sequence of fractions. I noticed that %% seems to behave inconsistently (to my untutored eye), thus: > 0.1%%0.1 [1] 0 > 0.2%%0.1 [1] 0 > 0.3%%0.1 [1] 0.1 > 0.4%%0.1 [1] 0 > 0.5%%0.1 [1] 0.1 > 0.6%%0.1 [1] 0.1 > 0.7%%0.1 [1] 0.1 > 0.8%%0.1 [1] 0 > 0.9%%0.1 The modulus for 0.1, 0.2, 0.4 and 0.8 is
2011 May 29
1
why does scan(gzfile("file"), what='integer') import data as mode "character" ?
Hi all, My code: x <- scan(gzfile("file"),what='integer') x is imported, but as mode "character" rather than "integer". I know I can do as.integer() when importing, but am still trying to figure out why the above occurs. When I do summary(as.integer(x)), there are no NAs introduced by coercion, so the vector really is all integer. Also, is the above
2018 Aug 09
1
Bug in POSIXct string representation?
Dear all, I just have identified the following issue which I believe could be a bug in R: Let me illustrate: First, enable the display of fractional seconds and check that it works: > options(digits.secs = 6, digits = 6) > as.character(as.POSIXct("2018-08-31 14:15:16.123456")) [1] "2018-08-31 14:15:16.123456" Now create a sequence of POSIXct with stepwidth 0.1sec:
2009 Mar 18
1
separating the integer part of a number from the fractional part
I have columns of decimal numbers (representing fraction day of year). I need to separate the fractional part of the number (to the right of the radix point) from the integer part. For example, if the number were '207.65' Id like to make a separate column which contained only '65' or even better, '0.65.' What I am trying to do is separate day from night. Any ideas?? Thanks.
2008 Feb 15
1
choose incorrect for fractional and some negative integer values (PR#10766)
Full_Name: Jerry W. Lewis Version: 2.6.2 OS: Windows XP Professional Submission from: (NULL) (198.180.131.16) choose() returns incorrect values for all fractional arguments, regardless of sign. It returns 0 when both arguments are negative integers, which is not always correct (as in some formulations of the negative hypergeometric). Examples (correct answers from Maple's binomial
2011 May 30
3
ideas about how to reduce RAM & improve speed in trying to use lapply(strsplit())
hi all, I'm full of questions today :). Thanks in advance for your help! Here's the problem: x <- c('18x.6','12x.9','302x.3') I want to get a vector that is c('18x','12x','302x') This is easily done using this code: unlist(lapply(strsplit(x,".",fixed=TRUE),function(x) x[1])) So far so good. The problem is that x is a vector
2015 Oct 21
1
Confusing print method for Inf dates
x <- as.Date(Inf, origin = "1970-01-01") x #> [1] NA str(x) #> Date[1:1], format: NA unclass(x) #> [1] Inf It's not clear what the correct behaviour is. The documentation for ?Date has: "It is intended that the date should be an integer,", which suggests that -Inf and Inf are not valid dates. But if that's true the behaviour for max.Date() needs some
2020 Sep 23
3
jitter-bug? problematic behaviour of the jitter function
Dear all, i have noticed some strange behaviour in the ?jitter? function in R. On the help page for jitter it is stated that "The result, say r, is r <- x + runif(n, -a, a) where n <- length(x) and a is the amount argument (if specified).? and "If amount is NULL (default), we set a <- factor * d/5 where d is the smallest difference between adjacent unique (apart from fuzz) x
2020 Sep 23
3
jitter-bug? problematic behaviour of the jitter function
Dear all, i have noticed some strange behaviour in the ?jitter? function in R. On the help page for jitter it is stated that "The result, say r, is r <- x + runif(n, -a, a) where n <- length(x) and a is the amount argument (if specified).? and "If amount is NULL (default), we set a <- factor * d/5 where d is the smallest difference between adjacent unique (apart from fuzz) x
2020 Sep 04
4
Misleading documentation on FP to integer conversion instructions?
If fptosi takes 0.9 -> 0, then that is not 'rounding' in any sense I'm aware of (IEEE754 or otherwise). Rounding (in the IEE754 sense) determines how a number is converted when it is halfway between two candidate results. (see round(), ceil(), floor()). fptosi seems to model the behavior of a C cast from float to int, which truncates the fractional bits (as in trunc()). Steve
2016 Feb 24
1
%OS on output
R help on 'strptime' has the following in "Details" section. Specific to R is ?%OSn?, which for output gives the seconds truncated to ?0 <= n <= 6? decimal places (and if ?%OS? is not followed by a digit, it uses the setting of ?getOption("digits.secs")?, or if that is unset, ?n = 3?). In reality, for output, if '%OS' is not followed by a digit and