Displaying 20 results from an estimated 5000 matches similar to: "Generating permutations that always include one specific element"
2009 Sep 28
3
Remove single entries
Dear Community,
I have a data set with two columns, bird number and mass. Individual birds
were captured 1-13 times and weighed each time. I would like to remove
those individuals that were captured only once, so that I can assess mass
variability per bird. I¹ve tried many approaches with no success. Can
anyone recommend a way to remove individuals that were captured only once?
Thanks,
Ray
2006 May 08
3
Non repetitive permutations/combinations of elements
Hello all,
I am trying to create a matrix of 1s and -1s without any repetitions for a
specified number of columns.
e.g. 1s and -1s for 3 columns can be done uniquely in 2^3 ways.
-1 -1 -1
-1 -1 1
-1 1 -1
-1 1 1
1 -1 -1
1 -1 1
1 1 -1
1 1 1
and for 4 columns in 2^4 ways and so on.
I finally used the function combn([0 1],3) that I found at the following link
2010 Jan 28
2
Constrained vector permutation
Hello,
I'm trying to permute a vector of positive integers > 0 with the constraint
that each element must be <= twice the element before it (i.e. for some
vector x, x[i] <= 2*x[i-1]), assuming the "0th" element is 1. Hence the
first element of the vector must always be 1 or 2 (by assuming the "0th"
element is 1). Similarly, the 2nd must always be below/= 4, the
2009 Mar 14
2
permutations in R
Hi. Does anyone know of a function which will take as input a number n (or a
set of n letters) and will give out, one at a time, the permutations of n
(or of those n letters) as a vector?
So that I can use the permutations one at a time. And such that it will
exhaust all the permutations with no repeats.
For example if n is 3, I would want a function which I could use in a loop
and the first time
2011 Nov 18
3
Permutations
Hi all,
why factorial(150) shows the error out of range in 'gammafn'?
I have to calculate the number of subset formed by 150 samples taking 10 at
a time. How is this possible?
best
[[alternative HTML version deleted]]
2011 Sep 29
1
Permutations of configurations on multiple columns
Hi,
I have got this start situation:
structure(list(subject = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L), .Label = c("s1", "s2"), class = "factor"),
part = structure(c(1L, 1L, 2L, 3L, 4L, 5L, 1L, 1L, 2L, 6L,
6L), .Label = c("p1", "p2", "p3", "p4", "p5", "p9"), class =
2002 Jan 16
2
exhaustive permutations
Hello R-help Readers
I'm currently in the process of trying to write a permutation test
procedure for looking at differences between groups with a multivariate
data set (something equivalent to ANOSIM - analaysis of similarities for
those familiar with this test). As with other permutation tests, for
cases where there are large numbers of possible permutations, randomly
sampling from these
2007 Jan 30
2
Permutation problem
Dear R-Users,
I need a matrix containing line by line all possible permutations with
length 'i' of the integers 1:N, given the restriction that the
integers in each row have to be in ascending order.
For example: N = 5, length i = 3, should result in a matrix like this:
1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5
I'm grateful for any advice on
2008 Apr 06
3
Multiset Permutations
Dear R users,
I want to perform an exact permutation of multisets. I have looked at the
coin package, but it doesn't seem to offer what I am looking for. I want to
perform permutations (exact - without duplications) on multisets of scalars
(e.g., the multiset 0,0,1,2,2). I want to output all the possible
permutations into a data frame so that each multiset permutation occupies a
row (or
2010 Jan 14
2
Fixed size permutations
I'm using functions to return a matrix of all permutations of a
specified size from a larger list for predictor selection.
For each predictor size I use a seperate function like this:
bag2 <- function(n) {
rl <- c()
for (i1 in seq(n)) {
for (i2 in seq(n)) {
if (length(unique(c(i1,i2)))==1) {next}
rl <- cbind(rl,matrix(c(i1,i2)))
}
}
2017 Dec 08
2
Curiously short cycles in iterated permutations with the same seed
I have noticed that when I iterate permutations of short vectors with the same seed, the cycle lengths are much shorter than I would expect by chance. For example:
X <- 1:10
Xorig <- X
start <- 112358
N <- 10
for (i in 1:N) {
seed <- start + i
for (j in 1:1000) { # Maximum cycle length to consider
set.seed(seed) # Re-seed RNG to same initial state
X <- sample(X)
2010 Jan 19
1
restricted permutations in permtest()?
Hallo List,
I'm trying to implemement a restricted permutation scheme in permutest(). More
precisely I have dependence in my data that should be allowed for in the
permutation - I simulated the problem in the example of the vegan documentation
p.24:
library(vegan)
data(varespec)
## Bray-Curtis distances between samples
dis <- vegdist(varespec)
## First 16 sites grazed, remaining 8 sites
2008 Jan 14
2
Permutations of variables in a dataframe
Hallo All,
I would like to apply a function to all permutations of variables in a
dataframe (except the first). What is the best way to achieve this?
I produce the permutations using:
nvar <- ncol(dat) - 1
perms <- as.matrix( expand.grid(rep( list(1:0) , nvar ))[ , nvar:1] )
Thanks in advance
Serguei
Test-dataframe, comma-delimited:
code,wav,w,area,gdp,def,pop,coast,milspend,agr
2008 Nov 24
3
Help With Permutations
I have a problem with permutations functions in R
I just started using R so maybe it is an easy question
I need to obtain all the 9.somthingExp 157 permutations that can be
given from the number from 1 to 100
I wrote the following commands:
> library(gregmisc)
>options(expressions=1e5)
cmat <- combinations(300,2)
dim(cmat) # 44850 by 2
>permutations(n=100, r=100)
2009 Dec 20
2
Remove rows in a matrix that match rows in another matrix
Dear R Community,
The following seems like a simple problem, but I''ve been stuck on it for
some time, with no luck using matching or subsetting functions. I''m trying
to remove the rows from a large matrix that match rows in another large
matrix. A (small scale) example:
col1<-c("A", "B", "C", "D")
col2<-c("A",
2017 Dec 08
0
Curiously short cycles in iterated permutations with the same seed
Hi Boris,
Do a search on "the order of elements of the symmetric group". (This search
will also turn up homework questions and solutions.) You will understand
why you are seeing this once you understand how a permutation is decomposed
into cycles and how the order relates to a partition of n (n=10 in your
case).
Enjoy!
Eric
On Fri, Dec 8, 2017 at 6:39 AM, Boris Steipe <boris.steipe
2008 Nov 14
1
Generating unique permutations of a vector
Hi all,
I try to generate sets of strategies that contain probability
distributions for a defined number of elements, e.g. imagine an
animal that can produce 5 different types of offspring and I want to
figure out which percentage of each type it should produce in order to
maximize its fitness. In order to do so, I need to calculate the fitness
for all potential strategies. As an example, if I
2007 Mar 06
3
Is there a quick way to count the number of times each element in a vector appears?
Hi there,
I'm writing a function that calculates the probability of different
outcomes of dice rolls (e.g., the sum of the highest three rolls of
five six-sided dice). I'm using the "combinations" function from the
"gtools" package, which is great: it gives me a matrix with all of the
possible combinations (with repetitions allowed). Now I want to count
the number
2005 Jun 20
2
app_valetparking.c
Since www.bkw.org seems not to exist anymore (getting response from some
hosting provider), does anyone happend to have a copy of app_valetparking.c
from www.bkw.org - the one that should work with * stable 1.0.X ? If so
please contact me.
One that can be downloaded from www.loligo.com dosn't compile with 1.0.X,
and SuperValletParking (www.asterlink.com/svp/) seems to be for * HEAD
2005 Jun 20
1
Re: app_valetparking.c for * STABLE (1.0.X)
Nope ! This is the one that tries to include PRE 1.0.X header file
<parking.h>.
It cannot compile on * 1.0.X (I have tried also to include <features.h>
instead of <parking.h> (as far as I know features.h is successor to
parking.h), but still without results).
Thanks anyway.
Nenad
>
> Try this
>
>> Since www.bkw.org seems not to exist anymore (getting