search for: colmatrix

Displaying 6 results from an estimated 6 matches for "colmatrix".

Did you mean: cmatrix
2002 Aug 28
2
all possible subsets of r out of n
Has anyone written a function that returns all possible subsets of r elements out of a vector that contains n elements? I have not been able to find an answer in the FAQ or the archives. Say I have a vector: letters[1:10]. I want to get a matrix of 120 rows that contains all possible subsets of 3 letters out of the 10. And I would like to be able to generalize to any r out of n, like
2001 Nov 20
3
Sampling from a population
Hi ALL: Suppose you have a population of N <- 5 observations, x <- c(43, 28, 7, 61, 39). From that you can draw a maximum of 10 samples without replacement of size n <- 3. (Command choose(N,n) yields 10). For instance the samples I seek are 43, 61, 7 39, 7, 28 ...etc How can I get R to do that for me, to get an exhaustive list of samples of size n drawn without replacement
1997 Aug 25
0
R-alpha: R FAQ
...nto a 2x3x4 array, losing the unnecessary dimension. After much discussion this has been determined to be a feature. To prevent this happening, add the option `drop = FALSE' to the subscripting. For example, rowmatrix <- mat[2, , drop = F] # creates a row matrix colmatrix <- mat[, 2, drop = F] # creates a column matrix a <- b[1, 1, 1, drop = F] # creates a 1x1x1 array The `drop = F' option should be used defensively when programming. For example, the statement somerows <- mat[index, ] will return a vector rather than a...
1997 Dec 09
3
R-beta: R FAQ v0.60
...nto a 2x3x4 array, losing the unnecessary dimension. After much discussion this has been determined to be a feature. To prevent this happening, add the option `drop = FALSE' to the subscripting. For example, rowmatrix <- mat[2, , drop = F] # creates a row matrix colmatrix <- mat[, 2, drop = F] # creates a column matrix a <- b[1, 1, 1, drop = F] # creates a 1x1x1 array The `drop = F' option should be used defensively when programming. For example, the statement somerows <- mat[index, ] will return a vector rather than a...
1997 Dec 09
3
R-beta: R FAQ v0.60
...nto a 2x3x4 array, losing the unnecessary dimension. After much discussion this has been determined to be a feature. To prevent this happening, add the option `drop = FALSE' to the subscripting. For example, rowmatrix <- mat[2, , drop = F] # creates a row matrix colmatrix <- mat[, 2, drop = F] # creates a column matrix a <- b[1, 1, 1, drop = F] # creates a 1x1x1 array The `drop = F' option should be used defensively when programming. For example, the statement somerows <- mat[index, ] will return a vector rather than a...
1997 Dec 09
3
R-beta: R FAQ v0.60
...nto a 2x3x4 array, losing the unnecessary dimension. After much discussion this has been determined to be a feature. To prevent this happening, add the option `drop = FALSE' to the subscripting. For example, rowmatrix <- mat[2, , drop = F] # creates a row matrix colmatrix <- mat[, 2, drop = F] # creates a column matrix a <- b[1, 1, 1, drop = F] # creates a 1x1x1 array The `drop = F' option should be used defensively when programming. For example, the statement somerows <- mat[index, ] will return a vector rather than a...