Displaying 2 results from an estimated 2 matches for "findsubsets".
2012 Jun 27
2
a problem of approach
...it), hence my question(s):
- would there be another (quicker) implementation in R?
- alternatively, should I go for a C implementation?
(actually, I did create a C implementation, but it doesn't bring any
more speed... it is actually a bit slower).
A real-life pet example, using the function findSubsets() from the QCA
package (our foo function above):
####
library(QCA)
testfoo <- function(x, y) {
index <- 0
while((index <- index + 1) < length(x)) {
x <- setdiff(x, findSubsets(y, x[index], max(x)))
}
return(x)
}
nofl <- rep(3, 14)
set.seed(12345)
numbers...
2012 Jul 27
1
C code validation
...nt result sometimes at each trial, even
with the very same data.
These are the relevant outputs from R:
> library(QCA)
Loading required package: lpSolve
> benchmark <- function(x, y) {
+ index <- 0
+ while((index <- index + 1) < length(x)) {
+ x <- setdiff(x, findSubsets(y + 1, x[index], max(x)))
+ }
+ return(x)
+ }
>
> set.seed(12345)
> exprnec <- sort(sample(13:19683, 500))
> noflevels <- rep(2, 9)
> mbase <- rev(c(1, cumprod(rev(noflevels + 1))))[-1]
> foo1 <- benchmark(exprnec, noflevels)
> foo2 <- .Call("removeR...