powered by
Methods for "[" and "[<-", i.e., extraction or subsetting of permutation vectors.
"["
"[<-"
Extraction and methods return an onion or onionmat. Replacement methods return an object of the same class as the right hand side.
Robin K. S. Hankin
Extraction and replacement for word form uses array-based indexing. Cycle form uses list-based indexing and is thus less flexible.
(a <- rperm(9)) a[1:3] a[5:7] <- id # word form: multiple replacements allowed. a x <- as.cycle(rperm(9)) x x[5] <- x[4] * x[6] # cycle form: replacement takes only a single index. x
Run the code above in your browser using DataLab