Questions tagged [permute]

permute is an R package for generating restricted permutations. Its original intention was for use with the vegan package to analyse multivariate models for ecological data.

permute is an R package that generates permutations from restricted designs, such as permutations within blocks. permute allows the following designs

  • Randomisation (free permutation)
  • Cyclic shifts for line transects and time series
  • Toroidal shifts for spatial grids

These can be nested hierarchically with samples present at 3 levels:

  • Block: these are never permuted, only samples within blocks are permuted.
  • Plot: Plots lie within Blocks. Plots may further restrict permutation (i.e. the plots are not permuted) or they may be permuted using any of the above 3 permutation types.
  • Within-plot: these are the samples at the lowest level, the individual rows of the data. These may be held fixed (within any Plots and/or Blocks) or be permuted following one of the three methods above)

This hierarchy allows for the testing of complex designs, including split-plot experimental designs.

68 questions
1
vote
1 answer

igraph permute() method bug

I want to node permute a graph. See the test graph I have created, below. When I use the permute() method from the igraph R library, no changes occur in the new graph permute() makes. What is happening? testG <- vector(mode="list", length=6);…
lrthistlethwaite
  • 494
  • 2
  • 6
  • 23
1
vote
1 answer

C++ - Permutation Function

I'm writing a permute function that creates a vector of ints from the n parameter and interleaves them, using recursion. I am getting a segmentation fault, but am having much trouble trying to get it to work. Here is my code: void print(const…
Bobbis
  • 137
  • 1
  • 7
1
vote
3 answers

How to perform shuffle on a list of words?

I want to do a shuffle on a list of words in R, either using permute::shuffle/shuffleSet() or any other function. Code: require(permute) a <- c("Ar","Ba","Bl","Bu","Ca") x <- list(a) x shuffleSet(x) shuffle(x) But when I try this code I get the…
RVRLibra
  • 63
  • 1
  • 12
1
vote
2 answers

Very long permutations - sentence anagram

I have an array of almost 2700 strings, i need to find the correct phrase for a sentence anagram. The list is a sorted list, of almost 100k item long list of words that would fit. And i want to combine them in 1, 2 & 3 words together and match on…
Simon Dragsbæk
  • 2,367
  • 3
  • 30
  • 53
1
vote
4 answers

Switching the first element with the last one in a loop

Is there a function in R which switches the first element with the last one in a vector? I have a for loop which need that reordering. From: months = seq(1:12) [1] 1 2 3 4 5 6 7 8 9 10 11 12 I would like to have: [1] 12 1 2 3 4 5 6 …
Ruser_edf
  • 13
  • 2
1
vote
1 answer

Calculate all possible and meaningful permutations

My problem is some kind of the Chinese postman problem. I got a maze in which the program puts n agents and n targets. Now every agent has to visit every target at least once. Therefore I have to calculate the shortest path between all targets using…
user3794592
  • 183
  • 2
  • 16
0
votes
0 answers

How to specify the proper permutation structure with 'how' for an unbalanced study design using adonis2 in R?

I have samples from animal subjects from two years, three regions, and two behavioral groups. The data are all observational, and the design of the study is very unbalanced. I want to know whether subjects that do a behavior (ch.binary) have…
0
votes
1 answer

How to use torch.Tensor.permute in torchvision model

I am using a Resnet50 classification model from torchvision which by default accepts images as inputs. I want to make the model accept numpy files (.npy) as inputs. I understand the two have different dimensions as the numpy data is given…
peony
  • 21
  • 1
  • 7
0
votes
0 answers

Cannot replace purrr::map with furrr::future_map when using permuted data

I am trying to replace purrr::map with furrr:future_map to run linear regressions on a list of permuted dataframes but I get the following error: Error in as.data.frame.default(data) : cannot coerce class ‘"permutation"’ to a data.frame Here's…
boleneuro
  • 23
  • 4
0
votes
1 answer

How to display all possible permutations of an array

I'm working on Permutations in Java. My program to is supposed to generate all possible permutations of an array with length n and arrange in r number of permutations. Here is an example. For an array with these 12 elements string Mywords[]…
0
votes
2 answers

How do I use python recursion in this scenario?

"Write a recursive function called anagram(s) that returns a list of all the possible anagrams of the string, s." Can I get some guidance on how to tackle this question? I am new to recursion and do not understand how to make a simpler base case for…
Luu Luu
  • 3
  • 2
0
votes
1 answer

R equivalent to permuting array dimensions permute(A, dimorder) in Matlab

I am looking for an equivalent of permute(A,dimorder) from Matlab, in order to convert some Matlab code to R. A loop entails a line that looks something like this: x = permute(a{i}(b(i,ii),:,:,:,:,:),[2 3 4 5 6 1]) The cell array structure e.g.…
0
votes
1 answer

Permute one column 1000 times in r

I have a df with two columns, ID and a character variable with "Y" and "N". I want to permute the second column 1000 times and assign a value to identify each permutation set. My end goal is to create a null distribution with the permutations. boot…
cp1412
  • 3
  • 1
0
votes
0 answers

How can I perform iterative, restricted permutations of a data set and model each?

I am trying to create many permutations of my data, but to preserve my stratified design. I need to model each randomized data set and then extract coefficients. I tried to use the gtools package's permute(), but it does not stratify as I need it…
Tess H
  • 25
  • 4
0
votes
1 answer

How to count the total possibilities of permute? (in C)

I'm new to programming, and i'm trying to complement this code in C to permute strings, currently it shows all the words exchanged and counts how many characters the word has. But I would like it to count the number of lines generated by the…
Wagner
  • 1
  • 2