Displaying 20 results from an estimated 243 matches for "combn".
Did you mean:
combo
2010 Mar 26
2
More efficient alternative to combn()?
Hi,
i am working on a problem where i need to compute the products of all
possible combinations of size m of the elements of a vector. I know that
this can be achieved using the function combn(), e.g.:
> vector <- 1:6
> combn(x = vector, m = 3, FUN = function(y) prod(y))
In my case the vector has 2000 elements and i need to compute the values
specified above for m = 32. Using combn() i encounter problems for m >= 4.
Is there any alternative to combn() that works more effici...
2012 Nov 16
1
pairing data using combn with criteria
...beetle. I would like to pair up the individuals for breeding. I
would, however, like to avoid breeding beetles of the same sex (obviously),
the same family, and with the same mother's family or father's family, to
avoid inbreeding.
The pairs of the beetles can be done with the function combn(individual, 2).
I have been trying to use the FUN argument of combn by reducing the options
for combn for each individual by negating the rows that share the same sex,
family, and parents' families, but I have had no success.
Is there an easy way to package all of this into a function for the...
2007 Apr 10
1
R CMD Rdconv drops sections: arguments, seealso, examples (PR#9606)
I've created a .Rd file (below), then converted that to .sgml using
R CMD Rdconv --type=Ssgm combn.Rd > combn.sgml
The output (shown below) is missing some of the sections:
arguments
seealso
examples
If instead I convert to .d (below), the same sections are missing,
and the "note" section is included but without the necessary newline.
-------------------------------------------...
2007 Apr 20
1
simply this loop?
Hi, anyone interested in this:
I tried to simply this loop with lapply or something but haven't figured it out:
mapt = c("203929_s_at", "203930_s_at", "203928_x_at", "206401_s_at")
mapt.combn <- lapply(1:4, function(i) combn(mapt, i))
out = list()
k = 1
for (i in 1:length(mapt.combn)){
for (j in 1:ncol(mapt.combn[[i]])){
out[[k]] = mapt.combn[[i]][,j]
k = k + 1
}
}
out
# the following two lines create a list of list, which is not my intended:
y0 = mapt.combn
lapply(1:4, func...
2010 Apr 07
1
combn with factors
Dear list,
I have come across this issue:
combn(letters[1:5], 3)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] "a" "a" "a" "a" "a" "a" "b" "b" "b" "c"
[2,] "b" "b" "b" "c" "...
2011 Oct 16
1
multicore combn
This is a 'rather than re-invent the wheel' post. Has anyone out there
re-written combn so that it can be parallelized - with multicore, snow, or
otherwise? I have a job that requires large numbers of combinations, and
rather than get all of the index values, then crank it through mclapply, I
was wondering if there was a way to just do this natively within a function.
Just curious....
2007 Apr 10
0
(PR#9606) R CMD Rdconv drops sections: arguments, seealso,
Ny understanding was that Insightful had been asked to provide patches fo
this.
We look forward to receiving them.
On Tue, 10 Apr 2007, timh at insightful.com wrote:
> I've created a .Rd file (below), then converted that to .sgml using
> R CMD Rdconv --type=Ssgm combn.Rd > combn.sgml
> The output (shown below) is missing some of the sections:
> arguments
> seealso
> examples
> If instead I convert to .d (below), the same sections are missing,
> and the "note" section is included but without the necessary newline.
>
> ----...
2010 Nov 17
1
efficient conversion of matrix column rows to list elements
Hi List,
I'm hoping to get opinions for enhancing the efficiency of the following
code designed to take a vector of probabilities (outcomes) and calculate a
union of the probability space. As part of the union calculation, combn()
must be used, which returns a matrix, and the parallelized version of
lapply() provided in the multicore package requires a list. I've found that
parallelization is very necessary for vectors of outcomes greater in length
than about 10 or 15 elements, which is why I need to make use of multic...
2006 May 09
1
combn(n, k, ...) and all its re-inventions
...EVISED: 10 July 1995
# AUTHOR: Scott Chasalow
OTOH, people have since reinvented the wheel quite prolifically:
There's combinations() in gtools {based on Bill Venables' code from R News 1/1},
combs() in CAtools, subsets() in BHH2, and nchoosek() in vsn (bioconductor);
then 'fwd.combn' in package "forward" which states explicitly
that it is Scott's combn() renamed..
I stopped searching for more, and I've made sure all
these 6 functions compute the same thing, at least in the most simple case.
After simply replacing nCm() by choose(), and some other minor
t...
2013 Sep 06
1
Importing function that is previously imported by other package
Dear developeRs,
I encounter the following problem: in the current version of my package
FrF2, certain calls to a functioni do not work when package combinat is
loaded, because function combn from combinat masks the function from
utils that my package uses.
I tried to solve this issue by importing function combn into the
namespace of FrF2; I don't need to export it, I just want to use it
internally in the package; I could of course find all occurrences and
replace them with util...
2011 Jan 10
1
Using combn
...replace=TRUE),
a2=sample(1:4, 20, replace=TRUE),
a3=sample(1:4, 20, replace=TRUE),
a4=sample(1:4, 20, replace=TRUE))
with(asd, table(a1, a2))
with(asd, table(a1, a3))
with(asd, table(a1, a4))
...
I'm sure there is a solution using "combn" - but I don't get it...
combn(colnames(asd), 2)
...
Thanks for any help!
Patrick
2013 Jan 24
2
Please help R error message "masked from 'package:utils':combn"
...> block
diagonal Fhiser matrix" and used the attached file on PFIM.
Could you please advise me about the following message?
*****************************
Loading required pakage: combinat
Attaching package:'combinat'
The following object(s) are masked from 'package:utils':combn
*****************************
Kind regards,
Fumie
2009 Sep 21
2
Combine vectors in order to form matrixes with combn
Hello!
I've a problem with the combn function and a set of vector. I
would like to make a simple combination where, instead of scalars, i
would like to combine vector, in order to form matrixes.
In other
words, i have nineteen 6-items vectors (for example coef1-coef19), that
i would like to combine in n!/k!(n-k)! 6x6 matrixes.
I...
2010 May 08
2
apply a function on elements of a list two by two
Dear all,
I want to apply a function to list elements, two by two. I hoped that combn
would help me out, but I can't get it to work. A nested for-loop works, but
seems highly inefficient when you have large lists. Is there a more
efficient way of approaching this?
# Make some toy data
data(iris)
test <- vector("list",3)
for (i in 1:3){
x <- levels(iris$Speci...
2007 Apr 30
1
R CMD Rdconv drops sections: arguments, seealso, examples (PR#9645)
On Tue, 10 Apr 2007 timh at insightful.com wrote:
> I've created a .Rd file (below), then converted that to .sgml using
> R CMD Rdconv --type=Ssgm combn.Rd > combn.sgml
> The output (shown below) is missing some of the sections:
> arguments
> seealso
> examples
> If instead I convert to .d (below), the same sections are missing,
> and the "note" section is included but without the necessary newline.
The underlyin...
2008 Feb 08
2
Applying lm to data with combn
...")# read it in
matrix format
#fruit =read.file(row.names=1)$data
mD =head(fruit[, 1:5])# only first five used in combinations
#X.SSMII = head(fruit[, 6])# Keep it for referebce
nmax = NULL
n = ncol(mD)# dont take the last column for reference purpose
if(is.null(nmax)) nmax = n
mDD = apply(combn(5, 1),1, FUN= function(y) mD[, y])# to
fg = lm( X.SSMII ~ X.GDAXI + X.FTSE + X.FCHI + X.IBEX, data = mDD )#
regress on combos
s = cbind(s, Residuals = residuals(fg))# take residuals
print(mD)
--
View this message in context: http://www.nabble.com/Applying-lm-to-data-with-combn-tp15359204p1...
2009 Aug 12
3
Combinatorial problem
I have been struggling trying to write some code to produce all
combinations subject to some restrictions. I thought someone might have
some bright ideas.
I have 11 values which fall into 5 groups. I want all combinations of
2,3, and 4 values where each value must be from a different group. The
numbers in the groups are different. Here is a definition of the groups:
groups <- list(gp1 =
2007 Mar 27
2
Newbie: Combn and scripting
Hello All,
I have just installed my R 2.4 (windows) as a test trying to load a data
frame and run combn() for each line into another file. How do I do this?
data.csv:
a,b,c,d
1,2,3.4
g,3,6,t
etc
x=data.csv, m=3
Thank you
Zam
_________________________________________________________________________________
This email contains confidential information intended only for the person named above an...
2007 Jan 19
2
combn implementation
Hi,
I was checking the source code to the function combn that "generates
all combinations of the elements of 'x' taken 'm' at a time.",
because I wished to modify it. I have a doubt about a statement.
This is the main loop.
._1 <- 1:1
nmmp1 <- n - m + ._1
while (a[1] != nmmp1) {
if (e < n - h) {...
2006 Jan 30
2
yet another vectorization question
..."all.expr" <-
function(column.names) {
ncolumns <- length(column.names)
return.matrix <- matrix(NA, nrow=(3^ncolumns - 1), ncol=ncolumns)
colnames(return.matrix) <- column.names
rownames(return.matrix) <- 1:nrow(return.matrix)
start.row <- 1
all.combn <- sapply(1:ncolumns, function(idx) {
as.matrix(combn(ncolumns, idx))
}, simplify=FALSE)
for (j in 1:length(all.combn)) {
idk <- all.combn[[j]]
tt <- matrix(NA, ncol=nrow(idk), nrow=2^nrow(idk))...