Henrik,
this is amazing! wow!
Thank you so much!
Dimitri
On 9/5/08, Henrik Bengtsson <[EMAIL PROTECTED]> wrote:
> names <- sprintf("V%d", 1:4);
> n <- length(names);
> stopifnot(n <= 32); # Theoretical upper limit
> x <- matrix(intToBits(1:(2^n-1)), ncol=2^n-1);
> x <- x[1:n,,drop=FALSE];
> keys <
You need to read the help file ?combos, and then use it to do indexing
of your objects, it only knows how to construct the integer combinations
given a pair (n,p).
url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217
Sorry,
I misread it first. I tried:
library(quantreg)
test.combos<-lapply(1:15,function(x)
{combos(15,x)
})
It gives me a list with an order that is somewhat different from
before, but I am not sure it helps me much:
[[1]]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [
names <- sprintf("V%d", 1:4);
n <- length(names);
stopifnot(n <= 32); # Theoretical upper limit
x <- matrix(intToBits(1:(2^n-1)), ncol=2^n-1);
x <- x[1:n,,drop=FALSE];
keys <- apply(x, MARGIN=2, FUN=function(z) paste(names[as.logical(z)],
collapse=":"));
print(keys);
[1] "V1" "V2"
I am not sure it can do it. Besides, I ran a test of combos from quantreg:
library(quantreg)
H<-1:3
test.combos<-lapply(1:3,function(x)
{combn(H,x)
})
Every time I tried it crashed my R...
:(
Dimitri
On 9/5/08, roger koenker <[EMAIL PROTECTED]> wrote:
> Does ?combos in the quantreg package do
Does ?combos in the quantreg package do what you want?
url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax: 217-244-6678Champaign, IL 61820
Dear all!
I have a vector of names
names<-("V1", "V2", "V3",., "V15")
I could create all possible combinations of these names (of all
lengths) using R:
combos<-lapply(1:15,function(x)
{combn(names,x)
})
I get a list with all possible combinations of elements of 'names'
that looks like this
7 matches
Mail list logo