search for: setequ

Displaying 20 results from an estimated 52 matches for "setequ".

Did you mean: seteq
2015 Jan 08
3
setequal: better readability, reduced memory footprint, and minor speedup
...> The && idea does have some merit, though. > > Apropos, why is there no setcontains()? > > -pd > > > On 06 Jan 2015, at 22:02 , Herv? Pag?s <hpages at fredhutch.org> wrote: > > > > Hi, > > > > Current implementation: > > > > setequal <- function (x, y) > > { > > x <- as.vector(x) > > y <- as.vector(y) > > all(c(match(x, y, 0L) > 0L, match(y, x, 0L) > 0L)) > > } > > > > First what about replacing 'match(x, y, 0L) > 0L' and 'match(y, x, 0L) > > 0L&...
2015 Jan 06
4
setequal: better readability, reduced memory footprint, and minor speedup
Hi, Current implementation: setequal <- function (x, y) { x <- as.vector(x) y <- as.vector(y) all(c(match(x, y, 0L) > 0L, match(y, x, 0L) > 0L)) } First what about replacing 'match(x, y, 0L) > 0L' and 'match(y, x, 0L) > 0L' with 'x %in% y' and 'y %in% x', res...
2015 Jan 08
0
setequal: better readability, reduced memory footprint, and minor speedup
I was thinking something like: setequal <- function(x,y) { xu = unique(x) yu = unique(y) if (length(xu) != length(yu)) { return FALSE; } return (all( match( xu, yu, 0L ) > 0L ) ) } This lets you fail early for cheap (skipping the allocation from the ">0L"s). Whether or not this goes fast depends a lot on the unique...
2015 Jan 08
0
setequal: better readability, reduced memory footprint, and minor speedup
...ability of source code is not usually our prime concern. The && idea does have some merit, though. Apropos, why is there no setcontains()? -pd > On 06 Jan 2015, at 22:02 , Herv? Pag?s <hpages at fredhutch.org> wrote: > > Hi, > > Current implementation: > > setequal <- function (x, y) > { > x <- as.vector(x) > y <- as.vector(y) > all(c(match(x, y, 0L) > 0L, match(y, x, 0L) > 0L)) > } > > First what about replacing 'match(x, y, 0L) > 0L' and 'match(y, x, 0L) > 0L' > with 'x %in% y' and &...
2020 May 20
3
Feature Request: User Prompt + Message First Execution when "Managing Search Path Conflicts"
...get the following behaviour when loading a package (Eg: dplyr): library(dplyr) ## Error: Conflicts attaching package ?dplyr?: ## ## The following objects are masked from ?package:stats?: ## ## filter, lag ## ## The following objects are masked from ?package:base?: ## ## intersect, setdiff, setequal, union So we would have to solve the conflict by writing: library(dplyr, mask.ok = c("filter", "lag", "intersect", "setdiff", "setequal", "union")) So my feature request proposals: ###...
2008 Nov 10
2
Make one vector from matrix comparison
...of a matrix with each row of another matrix. testmat1 <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) testmat2 <- matrix(c(1,2,3,5,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) Both matrix differs in the last row. Now I create a loop: for (i in (1:4)){ for (j in (1:4)){ b <- (c(setequal(testmat1[j,],testmat2[i,]))) print(b) } } R outputs me the following: [1] TRUE [1] FALSE [1] FALSE [1] FALSE [1] FALSE [1] TRUE [1] FALSE [1] FALSE [1] FALSE [1] FALSE [1] TRUE [1] FALSE [1] FALSE [1] FALSE [1] FALSE [1] FALSE but I need one vector like this: [1] TRUE FALSE FALSE FALSE FALSE...
2020 May 20
0
[External] Feature Request: User Prompt + Message First Execution when "Managing Search Path Conflicts"
...: dplyr): > > library(dplyr) > ## Error: Conflicts attaching package ?dplyr?: > ## > ## The following objects are masked from ?package:stats?: > ## > ## filter, lag > ## > ## The following objects are masked from ?package:base?: > ## > ## intersect, setdiff, setequal, union > > So we would have to solve the conflict by writing: > > library(dplyr, > mask.ok = c("filter", "lag", > "intersect", "setdiff", "setequal", > "union")) > >...
2017 Nov 08
2
Ggplot error
..."glimpse" "lst" "lst_" "tbl_sum" [13] "tibble" "tribble" "trunc_mat" "type_sum" "filter" "lag" [19] "intersect" "setdiff" "setequal" "union" $`package:purrr` [1] "%>%" "%>%" $`package:tidyr` [1] "%>%" "%>%" $`package:tibble` [1] "add_row" "as_data_frame" "as_tibble" "data_frame" "data_frame_"...
2017 Nov 08
0
Ggplot error
...; "lst" > "lst_" "tbl_sum" > [13] "tibble" "tribble" "trunc_mat" "type_sum" > "filter" "lag" > [19] "intersect" "setdiff" "setequal" "union" > > $`package:purrr` > [1] "%>%" "%>%" > > $`package:tidyr` > [1] "%>%" "%>%" > > $`package:tibble` > [1] "add_row" "as_data_frame" "as_tibble" &quo...
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/
2017 Nov 08
1
Ggplot error
..."? ? ? "lst" >? "lst_"? ? ? ? ? "tbl_sum" > [13] "tibble"? ? ? ? "tribble"? ? ? "trunc_mat"? ? "type_sum" > "filter"? ? ? ? "lag" > [19] "intersect"? ? "setdiff"? ? ? "setequal"? ? ? "union" > > $`package:purrr` > [1] "%>%" "%>%" > > $`package:tidyr` > [1] "%>%" "%>%" > > $`package:tibble` >? [1] "add_row"? ? ? "as_data_frame" "as_tibble"? ? "...
2014 Feb 07
2
suggestion for "sets" tools upgrade
...ologize in advance if this is the wrong place to submit a suggestion for a change to functions in the base-R package. It never really occurred to me that I'd have an idea worthy of such a change. My idea is to provide an upgrade to all the "sets" tools (intersect, union, setdiff, setequal) that allows the user to apply them in a strictly algebraic style. The current tools, as well documented, remove duplicate values in the input vectors. This can be helpful in stats work, but is inconsistent with the mathematical concept of sets and set measure. What I propose is that all t...
2005 Sep 16
2
fusion of rows (as in merge()) but from only 1 matrix
Dear all, Once again I need your help ; I fond a way to do what I want but I am sure there is a better way.. maybe you can help me. I have a matrix, for example mat.tot : > mat.tot ID Desc M1 M2 1 1 gene1 0.5 0.2 2 2 gene2 -0.4 -0.1 3 3 gene3 1.0 1.2 4 4 gene1 0.6 0.3 5 5 gene2 -0.3 0.0 and I want to merge line 1 with line 4, and line 2 with line 5 because this is the same gene. I can
2007 Apr 26
1
comparing two matrices, row by row
...r in the fourth row. I would like to compare them in order to know which columns are equal. The following works, but I would like to have a better solution, and not to use what someone called "prehistorical loops": for(i in c(1:4)) { cat(as.character(i),": ", as.character(setequal(ar1[i,],ar2[i,])), "\n") } 1 : TRUE 2 : TRUE 3 : TRUE 4 : FALSE I cannot devise how to use the apply function for this. Thanks a lot, Federico __________________________________________________ [[alternative HTML version deleted]]
2007 Mar 29
0
(PR#9589) 'union' does not handle factors while 'intersect'
...29 Mar 2007, prechelt at inf.fu-berlin.de wrote: > Full_Name: Lutz Prechelt > Version: 2.4.1 > OS: Windows XP > Submission from: (NULL) (160.45.111.67) > > > 'union' ignores the fact if its arguments are factors while all other set > operations (intersect, setdiff, setequal, is.element) treat them sensibly. > The manpage does not even mention the term 'factor'. Indeed, it excludes them as valid inputs. > Example: > f1=factor(c("a","b","b","c")); > f2=factor(c("a","d","d",&quo...
2019 Aug 28
1
R CMD check issue
...g required package: Gmisc Loading required package: Rcpp Loading required package: htmlTable Attaching package: 'dplyr' The following objects are masked from 'package:stats': ??? filter, lag The following objects are masked from 'package:base': ??? intersect, setdiff, setequal, union Quitting from lines 408-412 (timeSplitter.Rmd) Error: processing vignette 'timeSplitter.Rmd' failed with diagnostics: length of 'dimnames' [1] not equal to array extent --- failed re-building ?timeSplitter.Rmd? SUMMARY: processing the following file failed: ? ?timeSplitt...
2006 Sep 28
1
Comparing entire row sets at once efficiently
Dear useRs, I am having a hard time coming up with a nice and efficient solution to a problem on entires matrices or data.frames. In spirit, this is similar to what setdiff() and setequal() do, but I need it in more dimensions. Here's a brief description. * given a set of factors or sequences, expand.grid() gives me the set of permutations in a data.frame; in my case all arguments are numeric so I could convert the data frame to a matrix let's call t...
2017 Nov 08
0
Ggplot error
..." "lst" > "lst_" "tbl_sum" > [13] "tibble" "tribble" "trunc_mat" "type_sum" > "filter" "lag" > [19] "intersect" "setdiff" "setequal" "union" > > $`package:purrr` > [1] "%>%" "%>%" > > $`package:tidyr` > [1] "%>%" "%>%" > > $`package:tibble` > [1] "add_row" "as_data_frame" "as_tibble" "...
2008 Jun 05
5
vector comparison
I know this is fairly basic, but I must have somehow missed it in the manuals. I have two vectors, often of unequal length. I would like to compare them for identity. Order of elements do not matter, but they should contain the same. I.e: I want this kind of comparison: > if (1==1) show("yes") else show("blah") [1] "yes" > if (1==2) show("yes") else
2018 Jan 15
0
barplot that displays sums of values of 2 y colums grouped by different variables
...# ggplot library(dplyr) # `%>%`, group_by, summarise #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union library(tidyr) # gather dta <- read.table( text = "city n y mon 100 200 tor 209 300 edm 98 87 mon 20 76 tor 50 96 edm 62 27 ", header = TRUE ) dta2 <- ( dta %>% group_by( city ) %>% summarise( n = sum( n ) , y = sum( y )...