search for: permn

Displaying 20 results from an estimated 25 matches for "permn".

Did you mean: perm
2010 Jan 18
2
permutations from vectors out of a matrix
Dear R-Users, I'm relativley new to R and have the following problem. I need all permutations of the vectors created by the collumns of a matrix. I will give a small example: p=3 n=2^p-1 #number of obtainable vectors mat=matrix(0,p,p) for(i in 1:p) { mat[i:1,i]=1/i } mat is now a
2009 Aug 11
1
Help on a combinatorial task (lists?)
...e the given threshold 'q'. In other words, how often each weight is decisive in raising the cumulative sum above 'q'? Here is what I do: w <- c(3,2,1) # vector of weights q <- 4 # theshold # computes which coordinate of w is decisive in each permutation res <- sapply( permn(w), function(x) which(w == x[min(which(cumsum(x) >= q))]) ) # complies the frequencies prop.table( tabulate( res )) The problem I have is that when the weights are not unique, the which() function returns a list as opposed to a vector. I don?t know how to proceed when this happens, as tabu...
2006 May 08
3
Non repetitive permutations/combinations of elements
...ys and so on. I finally used the function combn([0 1],3) that I found at the following link http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7147&objectType=FILE written by Jos van der Geest in Matlab which generated the above. How can I do this is R? I have looked at permn and combn in the combinat library and permutations and combinations in the gtools library and I am still confused as to how to get it to work. Any suggestions will be truly appreciated. Thank you Nameeta ------------------------------------------------- This email is intended only for the use...
2015 Mar 12
2
PROBLEMA DE MEMORIA AL HACER PERMUTACIONES
...arias veces incrementando el largo del arreglo "MuestraS". El inconveniente esta en que al hacer las permutaciones con este arreglo de 12 espacios ya tengo problemas al parecer de memoria y posiblemente el arreglo deba ir hasta 100. Al ejecutar el siguiente código: MuestraP<-permn(MuestraS) Genera el siguiente error: Warning in vector("list", gamma(n + 1)) : Reached total allocation of 3991Mb: see help(memory.size) Es importante resaltar que en ningún momento le pido al programa que me muestra la matriz de permutaciones. Agradezco me puedan a...
2006 Sep 02
3
Dividing objects in classes using function sample()
...help me. I want to divide n objects in k classes and need an output with all (n+1)(n+2)/2 possibilities. For example n=4, k=3: That would be: 4 0 0 3 1 0 3 0 1 2 2 0 2 1 1 2 0 2 1 3 0 1 2 1 1 1 2 1 0 3 0 3 1 0 2 2 0 1 3 0 0 4 I tried to you use permn() or sample() but I don't know how to solve. Please help me! Best regards, Maja -- "Feel free" ? 10 GB Mailbox, 100 FreeSMS/Monat ...
2012 Jun 01
1
R Error : Error in vector("list", gamma(n + 1)) : vector size specified is too large
...listers, I am giving part of my R code : ########################################################### n=15 m=1 library("partitions") library("gregmisc") library("combinat") x = t(restrictedparts(n-m,m)) l = length(x[,1]) for(u in 1:l){ A= unique(matrix( unlist(permn(x[u,])), ncol=m, byrow=TRUE )) } ########################################################### when I put m=1 error shows : Error in vector("list", gamma(n + 1)) : vector size specified is too large . But it works fine with other values of m (< n). Any suggestion will be highly a...
2006 Aug 18
1
Permutations with replacement
Is there a simple function or process that will create a matrix of permutations with replacement? I know that using the combinat package ###### begin R code ###### > library(combinat) > m <- t(array(unlist(permn(3)), dim = c(3, 6))) # we can get the permutations, for example 3!=6 # gives us > m [,1] [,2] [,3] [1,] 1 2 3 [2,] 1 3 2 [3,] 3 1 2 [4,] 3 2 1 [5,] 2 3 1 [6,] 2 1 3 ###### end R code ########## I'd like to include the "with r...
2015 Mar 22
2
Combinatoria
...CORE las respondería al igual que responde a logaritmos en > cualquier base, determinantes e inversas de matrices. > > Pero no, hay que instalar paquetes adicionales. > > Buscando encontré que el paquete *combinat* incluye dos de estas funciones > > - *combn(m,n)* > - *permn(n)* > - *e incluso mCn(m,n)* > > N es solo que haga el cálculod e cuantas son sino que las escribe todas, > por ejemplo > > > combn(4,2) > [,1] [,2] [,3] [,4] [,5] [,6] > [1,] 1 1 1 2 2 3 > [2,] 2 3 4 3 4 4 > > > per...
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
2015 Mar 22
2
Combinatoria
...uier base, determinantes e inversas de matrices. > > > > > > Pero no, hay que instalar paquetes adicionales. > > > > > > Buscando encontré que el paquete *combinat* incluye dos de estas > funciones > > > > > > - *combn(m,n)* > > > - *permn(n)* > > > - *e incluso mCn(m,n)* > > > > > > N es solo que haga el cálculod e cuantas son sino que las escribe > todas, > > > por ejemplo > > > > > > > combn(4,2) > > > [,1] [,2] [,3] [,4] [,5] [,6] > > > [1,] 1 1 1 2 2 3...
2015 Mar 02
3
PERMUTACIONES EN R
Buena tarde amigos, En días pasados hice algunas consultas y ya pude salir de las dudas que tenia en ese momento, ahora requiero de su colaboración con lo siguiente: Tengo un vector dicotomico (Binario) con la siguiente información que me surgio de algunos procesos anteriores: > MuestraS [1] 1 1 1 1 0 1 1 0 1 1 Ahora necesito hallar todas las posibles combinaciones que se puedan hacer con
2010 Apr 24
2
multiple paired t-tests without loops
...tests. I have a loop version of the program working, but it would take a few weeks to complete the job and I was hoping that someone could tell me how to do it faster? thank you kindly, Matthew Finkbeiner -------------------------------- "Sample" "C1" "C2" "PermN" 1 5 8 perm1 1 4 3 perm1 1 6 4 perm1 2 2 6 perm1 2 3 1 perm1 2 7 4 perm1 1 8 5 perm2 1 3 4 perm2 1 6 4 perm2 2 6 2 perm2 2 1 3 perm2 2 7 4 perm2 1 5 8 perm3 1 3 4 perm3 1 6 4 perm3 2 2 6 perm3 2 1 3 perm3 2 7 4 perm3 1 8 5 perm4 1 4 3 perm4 1 4 6 perm4 2 6 2 perm4 2 3 1 perm4 2 4 7 perm4 1 5 8...
2015 Mar 22
3
Combinatoria
...uier base, determinantes e inversas de matrices. > > > > > > Pero no, hay que instalar paquetes adicionales. > > > > > > Buscando encontré que el paquete *combinat* incluye dos de estas > funciones > > > > > > - *combn(m,n)* > > > - *permn(n)* > > > - *e incluso mCn(m,n)* > > > > > > N es solo que haga el cálculod e cuantas son sino que las escribe > todas, > > > por ejemplo > > > > > > > combn(4,2) > > > [,1] [,2] [,3] [,4] [,5] [,6] > > > [1,] 1 1 1 2 2 3...
2012 Dec 01
4
Getting all possible contingency tables
Hello all, Let say I have 2-way contingency table: Tab <- matrix(c(8, 10, 12, 6), nr = 2) and the Chi-squared test could not reject the independence: > chisq.test(Tab) Pearson's Chi-squared test with Yates' continuity correction data: Tab X-squared = 1.0125, df = 1, p-value = 0.3143 However I want to get all possible contingency tables under this independence
2015 Mar 21
4
Combinatoria
En relación con lo que comenta Carlos, por ejemplo para el caso de las Variaciones sin Repetición, puede ser instructivoenseñar como se construye como por ejemplo: VsinR <- function(m, n){ return (factorial(m)/factorial(m-n))} VsinR(9,3) ------------------------- Creo que con la función factorial que viene por defecto en R puedes construir siguiendo este modelo rápidadmentecasi cualquier
2015 Mar 22
2
Combinatoria
...>> > > > Pero no, hay que instalar paquetes adicionales. >> > > > >> > > > Buscando encontré que el paquete *combinat* incluye dos de estas >> > funciones >> > > > >> > > > - *combn(m,n)* >> > > > - *permn(n)* >> > > > - *e incluso mCn(m,n)* >> > > > >> > > > N es solo que haga el cálculod e cuantas son sino que las escribe >> > todas, >> > > > por ejemplo >> > > > >> > > > > combn(4,2) >> >...
2009 Oct 10
1
permutations
Question 1. I would calculate all the permutations of numbers (23,46,70,71,89) How can I write correctly the code? (Load gregmisc) > permutations (..?...) ______________________ Question 2. It's possible permute a string? ..for example: EIGER EGIER EREGI etc..etc.. Thanks, E. -- View this message in context: http://www.nabble.com/permutations-tp25834463p25834463.html Sent from the R
2011 Dec 01
2
permutate elements in a vector
Hi all, I have a vector, e.g., A = c(10, 20, 30, 40). This 4 numbers have 4! = 24 different combination. I want to generate a matrix with one combination in one row, so the output would be B = 10 20 30 40 10 40 20 30 ... Does anyone know how to do this easily in R? Thank you very much. Wendy -- View this message in context:
2006 Aug 02
2
listing of permutations
Dear R People: Suppose I have the 4 numbers: 1,2,3,4. I would like to create a listing of the permutations of 4 items taken 4 at a time. Is there a built in function for that, please? Thanks in advance! R 2-3-1 for Windows or Linux Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: hodgess at gator.uhd.edu
2006 Sep 26
1
How to "Pack" a matrix
Hello, Suppose I have a matrix a where a= sp1 sp2 sp3 sp4 sp5 sp6 site1 1 0 1 1 0 1 site2 1 0 1 1 0 1 site3 1 1 1 1 1 1 site4 0 1 1 1 0 1 site5 0 0 1 0 0 1 site6 0 0 1 0 1 0 And I want to pack that matrix so that the upper left corner contains most of the ones and the bottom right corner contains most of the zeros so that matrix b is b= sp3 sp6 sp4 sp1 sp2 sp5 site1 1 1 1 1 0 0 site2