search for: anyduplicated

Displaying 20 results from an estimated 30 matches for "anyduplicated".

2009 May 08
1
anyDuplicated(incomp=NA) fails
With today's R 2.10.0(devel) I get: > anyDuplicated(c(1,NA,3,NA,5), incomp=NA) # expect 0 Warning: stack imbalance in 'anyDuplicated', 20 then 21 Warning: stack imbalance in '.Internal', 19 then 20 Warning: stack imbalance in '{', 17 then 18 [1] 0 > anyDuplicated(c(1,NA,3,NA,3), incomp=NA) # expect 5 Warning: stack imbalan...
2011 Nov 17
1
inaccuracy in man page for duplicated() + anyDuplicated() not working with MARGIN=0
...,2] [1,] 3 6 [2,] 2 2 [3,] 7 7 > duplicated(m) [1] FALSE FALSE FALSE Only if MARGIN=0 it seems: > duplicated(m, MARGIN=0) [,1] [,2] [1,] FALSE FALSE [2,] FALSE TRUE [3,] FALSE TRUE Also, any reason why this doesn't work? > anyDuplicated(m, MARGIN=0) Error in dim(newX) <- c(prod(d.call), d2) : dims [product 1] do not match the length of object [6] May be it could be equivalent to: > anyDuplicated(as.vector(m)) [1] 5 Thanks, H. -- Herv? Pag?s Program in Computational Biology Division of Public Health Scienc...
2024 Apr 05
1
duplicated() on zero-column data frames returns empty
...due to duplicated() > returning a zero-length vector for them, regardless of the number of > rows: > df <- data.frame(a = 1:5) > df$a <- NULLnrow(df) > # 5 (row count preserved by row.names) > duplicated(df) > # logical(0), should be c(FALSE, TRUE, TRUE, TRUE, TRUE) > anyDuplicated(df) > # 0, should be 2 > This behaviour isn't mentioned in the documentation; is there a > reason for it to work like this? <...> > I admit this is a case we rarely care about.However, for an example > of this being an issue, I've been running into it when treating d...
2013 Jan 17
2
error installing KEGGSOAP
...39;, 'JGR', 'kernlab', 'KernSmoot [... truncated] > library(KEGGSOAP) Loading required package: BiocGenerics Attaching package: ‘BiocGenerics’ The following object(s) are masked from ‘package:stats’:     xtabs The following object(s) are masked from ‘package:base’:     anyDuplicated, cbind, colnames, duplicated, eval, Filter, Find, get, intersect, lapply, Map, mapply, mget, order, paste,     pmax, pmax.int, pmin, pmin.int, Position, rbind, Reduce, rep.int, rownames, sapply, setdiff, table, tapply, union, unique failed to load HTTP resource Error : .onLoad failed in loadNamesp...
2011 Dec 02
1
1.6x speedup for requal() function (in R/src/main/unique.c)
...xi = REAL(x)[i]; yj = REAL(y)[j]; if (!ISNAN(xi) || !ISNAN(yj)) return xi == yj; return R_IsNA(xi) == R_IsNA(yj); } The logic of the cequal() function (in the same file) could also be cleaned up in a similar way, probably for an even greater speedup. This will benefit duplicated(), anyDuplicated() and unique() on numeric and complex vectors. Cheers, H. -- Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-...
2013 Aug 16
1
as.Date.character speed improvement suggestion
...s in real-life cases, I think this enhancement should certainly be considered. Also, in a worst case scenario of a long vector with only one duplicated value, the suggested change does not slow down the calculation. Here's a proof of concept: as.Date.character2 <- function(x, ...) { if (anyDuplicated(x)) { ux <- unique(x) idx <- match(x, ux) y <- as.Date.character(ux, ...) return(y[idx]) } as.Date.character(x, ...) } ## Example1: Construct a 1-million length character vector of 1000 unique dates ## By considering only unique values, speed is &gt...
2010 Dec 27
1
aperm() should retain class of input object
...chart.table* cloud.table* contourplot.table* dotplot.table* [6] head.table* levelplot.table* pairs.table* plot.table* print.table [11] summary.table tail.table* Non-visible functions are asterisked > > methods(class="array") [1] anyDuplicated.array as.data.frame.array as.raster.array* barchart.array* contourplot.array* dotplot.array* [7] duplicated.array levelplot.array* unique.array -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax:...
2018 May 09
1
NAs produced by integer overflow, but only some time ...
...and subtraction operators map them to integer results (giving NA's if the result cannot fit into 32 bits). Perhaps it was a mistake to include the integer type, but at the time S was developed it made sense. As for table(table(x)) being an unnatural construct, I use it all the time instead of anyDuplicated to see the pattern of duplications. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, May 9, 2018 at 12:04 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: > a) Numeric values may be either integers (signed 32 bit) or double > precision (53 bit mantissa). > > b) Doub...
2019 Oct 31
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
...ng(x) disagree. They've been such a nuisance for so many years... Thanks, H. > > The consequence of that is that > currently, "often" foo.matrix is just a copy of foo.array in > the case the latter exists: > "base" examples: foo in {unique, duplicated, anyDuplicated}. > > So I propose you change current head.matrix and tail.matrix to > head.array and tail.array > (and then have head.matrix <- head.array etc, at least if the > above quirk must remain, or remains (which I currently guess to > be the case)). > > > &g...
2016 Oct 02
1
grep
Hello. It would be great if the grep function in R had the option to use the -m parameter as the linux command does. That would allow to stop a grep search as soon as something is found. It would make many operations much faster. [[alternative HTML version deleted]]
2015 May 04
0
Version 3.16-0 of Hmisc now on CRAN
...ring, all.is.numeric: replaced options(warn=-1) with suppressWarnings() (thanks: Yihui) * arrGrob, print.arrGrob: new functions * wtd.var: added maximum likelihood method, fixed unbiased method, improved documentation (all provided by Benjamin Tyner) * Changed all any(duplicated()) to anyDuplicated(); thanks Benjamin Tyler * getRs: new function to interact with https://github.com/harrelfe/rscripts * knitrSet: new function to setup knitr with nice defaults for books etc. * rcorr: fixed sensing of NAs and diagonal elements of n matrix; thanks: Keith Jewell, Campden BRI Group;...
2015 May 04
0
Version 3.16-0 of Hmisc now on CRAN
...ring, all.is.numeric: replaced options(warn=-1) with suppressWarnings() (thanks: Yihui) * arrGrob, print.arrGrob: new functions * wtd.var: added maximum likelihood method, fixed unbiased method, improved documentation (all provided by Benjamin Tyner) * Changed all any(duplicated()) to anyDuplicated(); thanks Benjamin Tyler * getRs: new function to interact with https://github.com/harrelfe/rscripts * knitrSet: new function to setup knitr with nice defaults for books etc. * rcorr: fixed sensing of NAs and diagonal elements of n matrix; thanks: Keith Jewell, Campden BRI Group;...
2012 Jan 03
0
Biglm source code alternatives (E.g. Call to Fortran)
...14.04 11.0 22.54 17.6 "*" 6.44 5.0 6.44 5.0 "update.bigqr" 5.34 4.2 15.32 12.0 "-" 4.52 3.5 4.52 3.5 "anyDuplicated.default" 4.12 3.2 4.12 3.2 "/" 3.76 2.9 3.76 2.9 "attr" 3.26 2.5 3.26 2.5 "|" 2.96 2.3 2.96 2.3...
2012 Jun 29
0
Problem on loading annotation for BioC - error: RS-DBI driver: (error in statement: near "s": syntax error)
...ading required package: hugene10sttranscriptcluster.db Loading required package: AnnotationDbi Loading required package: BiocGenerics Attaching package: ?BiocGenerics? The following object(s) are masked from ?package:stats?: xtabs The following object(s) are masked from ?package:base?: anyDuplicated, cbind, colnames, duplicated, eval, Filter, Find, get, intersect, lapply, Map, mapply, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rbind, Reduce, rep.int, rownames, sapply, setdiff, table, tapply, union, unique Loading required package: Biobase Welcome to Bioconductor...
2009 Dec 01
4
Is there a function to test if all the elements in a vector are unique
length(unique(c(1,2,2)))==length(c(1,2,2)) I use the above test to test if all the elements in a vector are unique. But I'm wondering if there is a convenient function to do so in R library.
2019 Oct 29
5
head.matrix can return 1000s of columns -- limit to n or add new argument?
Hi all, So I've started working on this and I ran into something that I didn't know, namely that for x a multi-dimensional (2+) array, head(x) and tail(x) ignore dimension completely, treat x as an atomic vector, and return an (unclassed) atomic vector: > x = array(100, c(4, 5, 5)) > dim(x) [1] 4 5 5 > head(x, 1) [1] 100 > class(head(x)) [1] "numeric" (For a
2019 Oct 30
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...mething we should consider changing for R 4.0.0 -- to have it TRUE also for 2d-arrays aka matrix objects ??) The consequence of that is that currently, "often" foo.matrix is just a copy of foo.array in the case the latter exists: "base" examples: foo in {unique, duplicated, anyDuplicated}. So I propose you change current head.matrix and tail.matrix to head.array and tail.array (and then have head.matrix <- head.array etc, at least if the above quirk must remain, or remains (which I currently guess to be the case)). >> x = array(100, c(4, 5, 5)) >>...
2010 Feb 26
2
dramatic speed difference in lapply
So I have a function that does lapply's for me based on dimension. Currently only works for length(pivotColumns)=2 because I haven't fixed the rbinds. I have two versions. One runs WAYYY faster than the other. And I'm not sure why. Fast Version: fedb.ddplyWrapper2Fast <- function(data, pivotColumns, listNameFunctions, ...){ lapplyFunctionRecurse <- function(cdata, level=1,
2018 Dec 20
0
R 3.5.2 is released
...ner (PR#16802). * download.file(*, method = "curl", cacheOK = FALSE) should work now on Windows, thanks to Kevin Ushey's patch in PR#17323. * duplicated(<dataframe with 'f'>) now works, too, thanks to Andreas Kersting's PR#17485; ditto for anyDuplicated(). * legend(*, cex = 1:2) now works less badly. * The print() method for POSIXct and POSIXlt now correctly obeys getOption("max.print"), fixing a long-standing typo, and it also gets a corresponding optional max argument. * Unserialization of raw vectors seriali...
2018 Dec 20
0
R 3.5.2 is released
...ner (PR#16802). * download.file(*, method = "curl", cacheOK = FALSE) should work now on Windows, thanks to Kevin Ushey's patch in PR#17323. * duplicated(<dataframe with 'f'>) now works, too, thanks to Andreas Kersting's PR#17485; ditto for anyDuplicated(). * legend(*, cex = 1:2) now works less badly. * The print() method for POSIXct and POSIXlt now correctly obeys getOption("max.print"), fixing a long-standing typo, and it also gets a corresponding optional max argument. * Unserialization of raw vectors seriali...