search for: anyna

Displaying 20 results from an estimated 54 matches for "anyna".

Did you mean: anna
2019 May 01
3
anyNA() performance on vectors of POSIXct
Inside of the anyNA() function, it will use the legacy any(is.na()) code if x is an OBJECT(). If x is a vector of POSIXct, it will be an OBJECT(), but it is also TYPEOF(x) == REALSXP. Therefore, it will skip the faster ITERATE_BY_REGION, which is typically 5x faster in my testing. Is the OBJECT() condition really n...
2019 May 21
0
anyNA() performance on vectors of POSIXct
>>>>> Harvey Smith >>>>> on Wed, 1 May 2019 03:20:55 -0400 writes: > Inside of the anyNA() function, it will use the legacy any(is.na()) code if > x is an OBJECT(). If x is a vector of POSIXct, it will be an OBJECT(), but > it is also TYPEOF(x) == REALSXP. Therefore, it will skip the faster > ITERATE_BY_REGION, which is typically 5x faster in my testing. &gt...
2007 Aug 13
3
hasNA() / anyNA()?
Hi, is there a hasNA() / an anyNA() function in R? Of course, hasNA <- function(x) { any(is.na(x)); } would do, but that would scan all elements in 'x' and then do the test. I'm looking for a more efficient implementation that returns TRUE at the first NA, e.g. hasNA <- function(x) { for (kk in seq(along=...
2014 Aug 08
1
could not find function "anyNA" when building tools package in R 3.1.1
...ols/src' make[6]: Leaving directory `/home/btyner/R-3.1.1/src/library/tools/src' make[5]: Leaving directory `/home/btyner/R-3.1.1/src/library/tools/src' make[4]: Leaving directory `/home/btyner/R-3.1.1/src/library/tools' Error in .deparseOpts(control) : could not find function "anyNA" Calls: ::: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execution halted make[3]: *** [all] Error 1 make[3]: Leaving directory `/home/btyner/R-3.1.1/src/library/tools' make[2]: *** [R] Error 1 make[2]: Leaving directory `/home/btyner/R-3.1.1/src/library' m...
2018 May 08
1
Proposed speedup of ifelse
Hugh, (Note I speak for myself only and not for R-core) Thanks for looking into this. I think it's great to have community members that are interested in contributing to R and helping it continue to get better. And I think, and my local experiments bear out, that using anyNA as a fastpass condition does allow us to get a significant speedup over what's in there now. To do so, though, I took a somewhat different approach than your proposal: ifelse2 = function(test, yes, no) { if (is.atomic(test)) { if (typeof(test) != "logical") st...
2018 May 03
2
Proposed speedup of ifelse
> I propose a patch to ifelse that leverages anyNA(test) to achieve an > improvement in performance. For a test vector of length 10, the change > nearly halves the time taken and for a test of length 1 million, there > is a tenfold increase in speed. Even for small vectors, the > distributions of timings between the old and the proposed...
2016 Aug 21
1
'droplevels' inappropriate change
...and levels of 'x' doesn't contain NA, factor(x) gives the expected result for droplevels(x) , but factor(x, exclude = NULL) doesn't. As I said in https://stat.ethz.ch/pipermail/r-devel/2016-May/072796.html , factor(x, exclude = NULL) adds NA as a level. Using factor(x, exclude = if(anyNA(levels(x))) NULL else NA ) , like in the code of function `[.factor` (in the same file, factor.R, as 'droplevels'), is better. It is possible just to use x[, drop = TRUE] . For a factor 'x' that has NA level and also NA value, factor(x, exclude = NULL) is not perfect, though. It ch...
2018 May 03
1
Proposed speedup of ifelse
I propose a patch to ifelse that leverages anyNA(test) to achieve an improvement in performance. For a test vector of length 10, the change nearly halves the time taken and for a test of length 1 million, there is a tenfold increase in speed. Even for small vectors, the distributions of timings between the old and the proposed ifelse do not inter...
2018 May 17
2
Patch for bug 17256 'possible bug in writeForeignSAS in the foreign library when string is NA'
...ible bug in writeForeignSAS in the foreign library when string is NA' The patch 1. fixing the case where there were NA within a character column, and the case where all values are strings of length 0 2. general replacement of calls to `sapply` with `vapply` (and replacing any(is.na()) with anyNA. Happy to add in bugzilla (but don't have an account there) Regards Michael Nelson _______________________________________________________________________________________________________ Disclaimer: This message is intended for the addressee named and may contain confidential information...
2015 Mar 03
2
[R] Why does R replace all row values with NAs
...these basic operations are defined. > > There is conceptually a small set of "building blocks", at least for > objects with a vector-like or list-like semantic, that can be used > to formally describe the semantic of many functions in base R. This > is what the man page for anyNA does by saying: > > anyNA implements any(is.na(x)) > > even though the actual implementation differs, but that's ok, as long > as anyNA is equivalent to doing any(is.na(x)) on any object for which > building block is.na() is implemented. > > Unfortunately there is no...
2013 Oct 21
1
Set operation generics
Hi all, Would anyone be interested in reviewing a patch to make the set operations (union, intersect, setdiff, setequal, is.element) generic? Thanks, Hadley -- Chief Scientist, RStudio http://had.co.nz/
2009 Mar 06
0
modifying a built in function from the stats package (fixing arima) (CONCLUSIONS)
...es(xreg) <- if (ncxreg == 1) nmxreg else paste(nmxreg, 1:ncxreg, sep = "") if (include.mean && (nd == 0)) { xreg <- cbind(intercept = rep(1, n), xreg = xreg) ncxreg <- ncxreg + 1 } if (method == "CSS-ML") { anyna <- any(is.na(x)) if (ncxreg) anyna <- anyna || any(is.na(xreg)) if (anyna) method <- "ML" } if (method == "CSS" || method == "CSS-ML") { ncond <- order[2] + seasonal$order[2] * seasonal$period...
2015 Mar 03
2
[R] Why does R replace all row values with NAs
Diverted from R-help : .... as it gets into musing about new R language "primitives" >>>>> William Dunlap <wdunlap at tibco.com> >>>>> on Fri, 27 Feb 2015 08:04:36 -0800 writes: > You could define functions like > is.true <- function(x) !is.na(x) & x > is.false <- function(x) !is.na(x) & !x > and use
2015 Mar 03
0
[R] Why does R replace all row values with NAs
...ox on objects for which these basic operations are defined. There is conceptually a small set of "building blocks", at least for objects with a vector-like or list-like semantic, that can be used to formally describe the semantic of many functions in base R. This is what the man page for anyNA does by saying: anyNA implements any(is.na(x)) even though the actual implementation differs, but that's ok, as long as anyNA is equivalent to doing any(is.na(x)) on any object for which building block is.na() is implemented. Unfortunately there is no clearly identified set of building bl...
2016 May 13
1
complex NA's match(), etc: not back-compatible change proposal
...2 3 4 1 3 7 4 2 4 4 12 # R 2.10.1 (2009-12-14) > ## 1 2 3 4 1 3 7 4 2 4 4 12 # R 3.1.1 (2014-07-10) > ## 1 2 3 4 1 3 7 4 2 4 4 12 # R 3.2.5 -- and 3.3.0 patched > ## 1 2 1 2 1 1 1 1 2 2 1 2 # <<-- Martin's R-devel and proposed future R > if(!exists("anyNA", mode="function")) anyNA <- function(x) any(is.na(x)) > stopifnot(apply(zRI, 2, anyNA)) # *all* are NA *or* NaN (or both) > is.NA <- function(.) is.na(.) & !is.nan(.) > (iNaN <- apply(zRI, 2, function(.) any(is.nan(.)))) > (iNA <- apply(...
2015 Mar 03
0
[R] Why does R replace all row values with NAs
...ns are defined. >> >> There is conceptually a small set of "building blocks", at least for >> objects with a vector-like or list-like semantic, that can be used >> to formally describe the semantic of many functions in base R. This >> is what the man page for anyNA does by saying: >> >> anyNA implements any(is.na(x)) >> >> even though the actual implementation differs, but that's ok, as long >> as anyNA is equivalent to doing any(is.na(x)) on any object for which >> building block is.na() is implemented. >> &gt...
2019 Mar 02
1
stopifnot
.../err messages: - r <- withCallingHandlers( - tryCatch(if(missE) ...elt(i) else eval(cl.i, envir=envir), - error = function(e) { e$call <- cl.i; stop(e) }), - warning = function(w) { w$call <- cl.i; w }) + for (i in seq_len(n)) { + r <- ...elt(i) if (!(is.logical(r) && !anyNA(r) && all(r))) { + cl.i <- match.call(expand.dots=FALSE)$...[[i]] msg <- ## special case for decently written 'all.equal(*)': if(is.call(cl.i) && identical(cl.i[[1]], quote(all.equal)) && (is.null(ni <- names(cl.i)) || length(cl.i) == 3L |...
2007 Aug 23
0
indexing and regression testing
...length(match(c("a9","a99","a999","a9999"), iVec2)), 10, 1000) nom denom factor user.self 0.125 0.00022 568.1818 sys.self 0.002 0.00000 Inf elapsed 0.126 0.00022 572.7273 > > # and not too bad with respect to the recent hasNA() / anyNA() thread (once the index has been built) > timefactor(any(is.na(Vec1)), any(is.na(iVec1)), 50, 50) nom denom factor user.self 0.0040 0.003 1.333333 sys.self 0.0004 0.000 Inf elapsed 0.0044 0.003 1.466667 > timefactor(any(is.na(Vec2)), any(is.na(iVec2)), 50, 50)...
2016 May 28
1
complex NA's match(), etc: not back-compatible change proposal
...R 2.10.1 (2009-12-14) ? ? >> ## 1 2 3 4 1 3 7 4 2 4 4 12? # R 3.1.1? (2014-07-10) ? ? >> ## 1 2 3 4 1 3 7 4 2 4 4 12? # R 3.2.5 -- and 3.3.0 patched ? ? >> ## 1 2 1 2 1 1 1 1 2 2 1 2???# <<-- Martin's R-devel and proposed future R ? ? >> if(!exists("anyNA", mode="function")) anyNA <- function(x) any(is.na(x)) ? ? >> stopifnot(apply(zRI, 2, anyNA)) # *all* are? NA *or* NaN (or both) ? ? >> is.NA <- function(.) is.na(.) & !is.nan(.) ? ? >> (iNaN <- apply(zRI, 2, function(.) any(is.nan(.)))) ? ? &g...
2017 Aug 09
2
Package nleqslv ERROR
...[1+k]))*((((-1+1*x[2])^2)/2)^(-ALPHA[1+i]))))^(1/(1-2*ALPHA[1+i]-1.5*(GAMMA[1+k]))) f[4] <- 1*x[2] > 1 f } Result <- matrix(0,nrow=9*9*9,ncol=6) startx<-c(16350, 1.33) indx <- 1 for (i in 1:9) { for (j in 1:9) { for (k in 1:9) { f.startx <- fun(startx) if(anyNA(f.startx)) { Result[indx,1:3] <- NA } else { z <- nleqslv(startx,fun) Result[indx,1:3] <- c(z$termcd,z$x) } Result[indx,4:6] <- c(i,j,k) indx <- indx+1 } } } The error i get when solving for specific values of ALPHA, BETA and GA...