search for: isfalse

Displaying 20 results from an estimated 21 matches for "isfalse".

2009 Oct 10
1
isFALSE
Hello, Just wondering why there is "isTRUE" and not "isFALSE". Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/BcPw : celebrating R commit #50000 |- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc `- http://tr.im/yw8E : New R package : sos -------------- next p...
2018 Mar 14
0
Possible Improvement to sapply
>>>>> Henrik Bengtsson <henrik.bengtsson at gmail.com> >>>>> on Tue, 13 Mar 2018 10:12:55 -0700 writes: > FYI, in R devel (to become 3.5.0), there's isFALSE() which will cut > some corners compared to identical(): > > microbenchmark::microbenchmark(identical(FALSE, FALSE), isFALSE(FALSE)) > Unit: nanoseconds > expr min lq mean median uq max neval > identical(FALSE, FALSE) 984 1138 1694.13 1218.0 1337.5...
2018 Mar 13
2
Possible Improvement to sapply
FYI, in R devel (to become 3.5.0), there's isFALSE() which will cut some corners compared to identical(): > microbenchmark::microbenchmark(identical(FALSE, FALSE), isFALSE(FALSE)) Unit: nanoseconds expr min lq mean median uq max neval identical(FALSE, FALSE) 984 1138 1694.13 1218.0 1337.5 13584 100 is...
2018 Mar 13
1
Possible Improvement to sapply
Could your code use vapply instead of sapply? vapply forces you to declare the type and dimensions of FUN's output and stops if any call to FUN does not match the declaration. It can use much less memory and time than sapply because it fills in the output array as it goes instead of calling lapply() and seeing how it could be simplified. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue,
2018 Mar 13
0
Possible Improvement to sapply
Quite possibly, and I?ll look into that. Aside from the work I was doing, however, I wonder if there is a way such that sapply could avoid the overhead of having to call the identical function to determine the conditional path. From: William Dunlap [mailto:wdunlap at tibco.com] Sent: Tuesday, March 13, 2018 12:14 PM To: Doran, Harold <HDoran at air.org> Cc: Martin Morgan <martin.morgan
2023 Apr 25
1
xyTable(x,y) versus table(x,y) with NAs
I correct myself. Obviously, the line first[is.na(first) | isFALSE(first)] <- FALSE should read first[is.na(first)] <- FALSE Serguei. Le 25/04/2023 ? 11:30, Serguei Sokol a ?crit?: > Le 25/04/2023 ? 10:24, Viechtbauer, Wolfgang (NP) a ?crit?: >> Hi all, >> >> Posted this many years ago >> (https://stat.ethz.ch/pipermail/r-deve...
2023 Apr 25
1
xyTable(x,y) versus table(x,y) with NAs
...der(x, y) ??????? x <- x[orderxy] ??????? y <- y[orderxy] ??????? first <- c(TRUE, (x[-1L] != x[-n]) | (y[-1L] != y[-n])) ??????? firstNA <- c(TRUE, xor(is.na(x[-1L]), is.na(x[-n])) | xor(is.na(y[-1L]), is.na(y[-n]))) ??????? first[firstNA] <- TRUE ??????? first[is.na(first) | isFALSE(first)] <- FALSE ??????? x <- x[first] ??????? y <- y[first] ??????? diff(c((1L:n)[first], n + 1L)) ??? } ??? else integer() ??? list(x = x, y = y, number = number) } Best, Serguei. > > Best, > Wolfgang > > ______________________________________________ > R-devel...
2018 Jul 30
2
Code Optimization: print.data.frame + as.data.frame(head(x, n = options("max.print")))
...(or 0-length row.names)\n")) } else { x <- as.data.frame(head(x, n = options("max.print"))) m <- as.matrix(format.data.frame(x, digits = digits, na.encode = FALSE)) if (!isTRUE(row.names)) dimnames(m)[[1L]] <- if (isFALSE(row.names)) rep.int("", n) else row.names print(m, ..., quote = quote, right = right) } invisible(x) } Thank you. Best, Juan
2019 Aug 15
4
Feature request: non-dropping regmatches/strextract
...event dropping positions with no matches.? An example solution (last option): strextract <- function(pattern, x, perl = FALSE, useBytes = FALSE, drop = T) { m <- regexec(pattern, x, perl=perl, useBytes=useBytes) result <- regmatches(x, m) if(isTRUE(drop)){ unlist(result) } else if(isFALSE(drop)) { unlist({result[lengths(result)==0] <- NA_character_; result}) } else { stop("Invalid argument for `drop`") } } Based on?Ricardo Saporta's response to?How to prevent regmatches drop non matches? --CG
2019 Mar 02
1
stopifnot
...cl <- if(missE) { ## use '...' instead of exprs - match.call(expand.dots=FALSE)$... } else { - if(...length()) + if(n) stop("Must use 'exprs' or unnamed expressions, but not both") envir <- if (isTRUE(local)) parent.frame() else if(isFALSE(local)) .GlobalEnv else if (is.environment(local)) local else stop("'local' must be TRUE, FALSE or an environment") exprs <- substitute(exprs) # protect from evaluation - E1 <- exprs[[1]] + E1 <- if(is.call(exprs)) exprs[[1]] + cl <-...
2019 May 30
2
stopifnot
...@ -31,7 +31,7 @@ .Internal(stop(call., .makeMessage(..., domain = domain))) } -stopifnot <- function(..., exprs, local = TRUE) +stopifnot <- function(..., exprs, evaluated = FALSE, local = TRUE) { n <- ...length() if(!missing(exprs)) { @@ -41,21 +41,19 @@ else if(isFALSE(local)) .GlobalEnv else if (is.environment(local)) local else stop("'local' must be TRUE, FALSE or an environment") - exprs <- substitute(exprs) # protect from evaluation - E1 <- if(is.call(exprs)) exprs[[1]] + E1 <- if(!evaluated && is.call(exprs <- su...
2019 Mar 05
2
stopifnot
...d of exprs ? ? > -? ? ? ? match.call(expand.dots=FALSE)$... ? ? > } else { ? ? > -? ? ? ? if(...length()) ? ? > +? ? ? ? if(n) ? ? > stop("Must use 'exprs' or unnamed expressions, but not both") ? ? > envir <- if (isTRUE(local)) parent.frame() ? ? > else if(isFALSE(local)) .GlobalEnv ? ? > else if (is.environment(local)) local ? ? > else stop("'local' must be TRUE, FALSE or an environment") ? ? > exprs <- substitute(exprs) # protect from evaluation ? ? > -? ? ? ? E1 <- exprs[[1]] ? ? > +? ? ? ? E1 <- if(is.call(exprs)...
2019 Mar 05
0
stopifnot
...LSE)$... > ? ? > } else { > ? ? > -? ? ? ? if(...length()) > ? ? > +? ? ? ? if(n) > ? ? > stop("Must use 'exprs' or unnamed expressions, but not both") > ? ? > envir <- if (isTRUE(local)) parent.frame() > ? ? > else if(isFALSE(local)) .GlobalEnv > ? ? > else if (is.environment(local)) local > ? ? > else stop("'local' must be TRUE, FALSE or an environment") > ? ? > exprs <- substitute(exprs) # protect from evaluation > ? ? > -? ? ? ? E1 <- exprs[[1]] >...
2019 Aug 15
0
Feature request: non-dropping regmatches/strextract
...; An example solution (last option): > > strextract <- function(pattern, x, perl = FALSE, useBytes = FALSE, drop = > T) { > m <- regexec(pattern, x, perl=perl, useBytes=useBytes) > result <- regmatches(x, m) > > if(isTRUE(drop)){ > unlist(result) > } else if(isFALSE(drop)) { > unlist({result[lengths(result)==0] <- NA_character_; result}) > } else { > stop("Invalid argument for `drop`") > } > } > > Based on Ricardo Saporta's response to How to prevent regmatches drop non > matches? > > --CG > > __________...
2019 Aug 29
0
Feature request: non-dropping regmatches/strextract
...; An example solution (last option): > > strextract <- function(pattern, x, perl = FALSE, useBytes = FALSE, drop = > T) { > m <- regexec(pattern, x, perl=perl, useBytes=useBytes) > result <- regmatches(x, m) > > if(isTRUE(drop)){ > unlist(result) > } else if(isFALSE(drop)) { > unlist({result[lengths(result)==0] <- NA_character_; result}) > } else { > stop("Invalid argument for `drop`") > } > } > > Based on Ricardo Saporta's response to How to prevent regmatches drop non > matches? > > --CG > > __________...
2019 Mar 02
0
stopifnot
...{ ## use '...' instead of exprs - match.call(expand.dots=FALSE)$... } else { - if(...length()) + if(n) stop("Must use 'exprs' or unnamed expressions, but not both") envir <- if (isTRUE(local)) parent.frame() else if(isFALSE(local)) .GlobalEnv else if (is.environment(local)) local else stop("'local' must be TRUE, FALSE or an environment") exprs <- substitute(exprs) # protect from evaluation - E1 <- exprs[[1]] + E1 <- if(is.call(exprs)) exprs[[1]]...
2013 Nov 15
1
Inconsistent results between caret+kernlab versions
I'm using caret to assess classifier performance (and it's great!). However, I've found that my results differ between R2.* and R3.* - reported accuracies are reduced dramatically. I suspect that a code change to kernlab ksvm may be responsible (see version 5.16-24 here: http://cran.r-project.org/web/packages/caret/news.html). I get very different results between caret_5.15-61 +
2023 Apr 25
2
xyTable(x,y) versus table(x,y) with NAs
Hi all, Posted this many years ago (https://stat.ethz.ch/pipermail/r-devel/2017-December/075224.html), but either this slipped under the radar or my feeble mind is unable to understand what xyTable() is doing here and nobody bothered to correct me. I now stumbled again across this issue. x <- c(1, 1, 2, 2, 2, 3) y <- c(1, 2, 1, 3, NA, 3) table(x, y, useNA="always") xyTable(x, y)
2019 Feb 27
1
stopifnot
...cl <- if(missE) { ## use '...' instead of exprs - match.call(expand.dots=FALSE)$... } else { - if(...length()) + if(n) stop("Must use 'exprs' or unnamed expressions, but not both") envir <- if (isTRUE(local)) parent.frame() else if(isFALSE(local)) .GlobalEnv else if (is.environment(local)) local else stop("'local' must be TRUE, FALSE or an environment") exprs <- substitute(exprs) # protect from evaluation - E1 <- exprs[[1]] + E1 <- if(is.call(exprs)) exprs[[1]] + cl <-...
2018 Apr 23
0
R 3.5.0 is released
...(Suggestion of PR#17242.) * New low level utilities ...elt(n) and ...length() for working with ... parts inside a function. * isTRUE() is more tolerant and now true in x <- rlnorm(99) isTRUE(median(x) == quantile(x)["50%"]) New function isFALSE() defined analogously to isTRUE(). * The default symbol table size has been increased from 4119 to 49157; this may improve the performance of symbol resolution when many packages are loaded. (Suggested by Jim Hester.) * line() gets a new option iter = 1. * Reading from c...