similar to: combinatorics

Displaying 20 results from an estimated 1000 matches similar to: "combinatorics"

2006 Mar 06
1
combinatorics again
Hi I want to enumerate all vectors of length "J", whose elements are integers in the range 1 to S, without regard to ordering. With J=S=3, the combinations are as follows: [,1] [,2] [,3] [1,] 1 1 1 [2,] 1 1 2 [3,] 1 1 3 [4,] 1 2 2 [5,] 1 2 3 [6,] 1 3 3 [7,] 2 2 2 [8,] 2 2 3 [9,] 2
2000 May 03
0
Combinatorics for nonparametric tests
For some small sample sizes I would like to exemplify the combinatorics underlying certain nonparametric tests like Mann-Whitney-Wilcoxon, Kruskal-Wallis and Spearman's rank correlation. I have written a function all.perm which delivers all permutations of 1,2,...,n and which works reasonably well. This can be used to generate P(R=r) of Spearman's rank correlation:
2006 Jul 13
1
looping using combinatorics
I have a problem where I need to loop over the total combinations of vectors (combined once chosen via combinatorics). Here is a simplification of the problem: STEP 1: Define three vectors a, b, c. STEP 2: Combine all possible pairwise vectors (i.e., 3 choose 2 = 3 possible pairs of vectors: ab,ac, bc) NOTE: the actual problem has 8 choose 4, 8 choose 5 and 8 choose 6 combinations. STEP
2006 Jul 27
4
inserting rows into a matrix
Hi I have a little vector function that takes a vector A of strictly positive integers and outputs a matrix M each of whose columns is the vector, modified in a complicated combinatorical way. Now I want to generalize the function so that A can include zeroes. Given A, I want to strip out the zeroes, pass it to my function, and pad M with rows at positions corresponding to the zeroes
2007 Nov 19
2
All nonnegative integer solution
Dear all, Is there any method in R to find all possible nonnegative integer solutions to the linear equation with unit coefficients as follow: X1+X2+...+Xk=N Thank you, Amin Zollanvari
2007 Mar 05
1
enumerating non-overlapping pairs of elements from a vector
Hi All, I'm trying to come up with a clear and concise (and fast?) solution to the following problem. I would like to take a vector 'v' and enumerate all of the ways in which it can be broken into n sets of length 2 (if the length of the vector is odd, and an additional set of length 1). An element of 'v' can only appear in one set. Order within sets is not important.
2003 Feb 13
6
generic handling of NA and NaN and NULL
Hello everybody I have a generic problem which the following toy function illustrates: f <- function(n) { if(abs(n) < pi) { return(TRUE) } else { return(FALSE) } } I want it to return TRUE if abs(n)<pi and FALSE otherwise. f() is fine as far as it goes, but does not deal well with NA or NaN or NULL (I want these to signal some problem with the
2005 Jan 07
1
Visualizing complex analytic functions using domain coloring
Hi has anyone coded up domain colouring for visualizing complex analytic functions (such as elliptic functions)? [ the idea is to depict a complex function f(z) using a filled.contour() variant in which the hue is given by Arg(f(z)), and the saturation by Mod(f(z)). ] -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre European Way, Southampton SO14 3ZH, UK tel
2019 May 08
4
openblas
Hello, macosx 10.13.6, Rdevel r76458 I'm trying to compile against openblas to reproduce an error on the CRAN check page (my package is clean under winbuilder and all but one of the checks). I've downloaded and installed openblas 0.3.7 but I am not 100% sure that it is being used by R. Using ./configure --with-blas="-lopenblas" Then running R to discover the PID I get:
2007 Jan 16
5
"[[" gotcha
The following gotcha caught me off-guard just now. I have two matrices, a and b: a <- matrix(1,3,3) b <- matrix(1,1,1) (note that both "a" and "b" are matrices). I want them in a list: > B <- NULL > B[[1]] <- a > B[[2]] <- b > B [[1]] [,1] [,2] [,3] [1,] 1 1 1 [2,] 1 1 1 [3,] 1 1 1 [[2]] [,1] [1,] 1
2003 May 02
3
letters to numbers conversion
Hello List How do I turn R> simple.example.alphabetic [,1] [,2] [,3] [1,] "a" "b" "c" [2,] "d" "e" "f" [3,] "g" "h" "i" into R> simple.example.numeric [,1] [,2] [,3] [1,] 1 2 3 [2,] 4 5 6 [3,] 7 8 9 [ie "a" becomes 1, ..., "z"
2006 Feb 22
3
elements that appear only once
Hi. I have a factor and I want to extract just those elements that appear exactly once. How to do this? Toy example follows. > a <- as.factor(c(rep("oak",5) ,rep("ash",1),rep("elm",1),rep ("beech",4))) > a [1] oak oak oak oak oak ash elm beech beech beech beech Levels: ash beech elm oak > table(a) a ash beech elm oak
2002 Dec 11
2
ordering x's and y's
Hello ALL: How do I get R to list all possible orderings of 2 x's and 3 y's? It should look like this (which rows appear first is unimportant): x x y y y x y x y y x y y x y x y y y x y x x y y y x y x y y x y y x y y x x y y y x y x y y y x x Thanks, ANDREW
2019 Mar 01
2
pcre problems
OK thanks Tomas, but I get OK~ sudo apt-get build-dep r-base Reading package lists... Done E: Unable to find a source package for r-base OK~ hankin.robin at gmail.com On Fri, Mar 1, 2019 at 8:47 PM Tomas Kalibera <tomas.kalibera at gmail.com> wrote: > > On 3/1/19 7:10 AM, robin hankin wrote: > > thanks for this guys. > > > > I only compiled pcre myself as a last
2019 Mar 01
2
pcre problems
OK thanks Tomas, but I get OK~ sudo apt-get build-dep r-base Reading package lists... Done E: Unable to find a source package for r-base OK~ hankin.robin at gmail.com On Fri, Mar 1, 2019 at 8:47 PM Tomas Kalibera <tomas.kalibera at gmail.com> wrote: > > On 3/1/19 7:10 AM, robin hankin wrote: > > thanks for this guys. > > > > I only compiled pcre myself as a last
2006 Dec 14
4
two connected graphs
Hi I have two datasets, A and B, consisting of two columns of numbers representing x and y coordinates. They have 10 and 6 rows respectively. I want to plot two scattergraphs, one above the other. The lower graph to contain A (10 points) and the upper graph to contain B (six points). The x-axes of the two graphs must line up. I then want to draw straight lines that connect points of B to a
2007 Mar 19
3
character to numeric conversion
Hi. Is there a straightforward way to convert a character string containing comma-delimited numbers to a numeric vector? In my application, I use system(executable.string, intern=TRUE) which returns a string like "[0.E-38, 2.096751179214927596171268230, 3.678944959657480671183123052, 4.976528845643001020345216157, 6.072390165503099343887569007, 7.007958550337542210168866070,
2003 Jun 23
3
right assignment ("->") and functions
Hi everyone check this out [R-1.7.0]: R> f1 <- function(x){x^2} R> f1 -> f2 R> f2(4) [1] 16 R> R> function(x){x^2} -> f3 function(x){x^2} -> f3 R> f3(4) Error: couldn't find function "f3" Why does right assignment "->" work in the first but not the second case? Can anyone else reproduce this? -- Robin Hankin, Lecturer, School of
2005 Jun 13
3
extracting components of a list
Hi how do I extract those components of a list that satisfy a certain requirement? If jj <- list(list(a=1,b=4:7),list(a=5,b=3:6),list(a=10,b=4:5)) I want just the components of jj that have b[1] ==4 which in this case would be the first and third of jj, viz list (jj[[1]],jj[[3]]). How to do this efficiently? My only idea was to loop through jj, and set unwanted components to NULL,
2002 Nov 26
5
unexpected behaviour of rnorm()
Hello everyone. If I do f <- function(n){max(rnorm(n))} plot(sapply(rep(5000,4000),f)) #[this takes my PC about 30 seconds] then I get something quite unexpected: gaps in the distribution. For me, the most noticable one is at about 3.6. Do others get this? Is it an optical illusion? It can't be right, can it? Or maybe I just don't understand the good ol' Gaussian very