search for: mdim

Displaying 4 results from an estimated 4 matches for "mdim".

Did you mean: dim
2005 Nov 22
4
the matrix of rows with specific row sums
I am just starting with R and have the following problem: given a matrix of ones and zeroes, say mdim=4 m<-matrix(round(runif(mdim^mdim)),mdim,mdim) how to construct the matrix of those rows of m, whose elements sum to 2. Contrary to the random matrix above, the actual matrix always has at least one such row. Serguei Kaniovski
2003 May 21
2
moving onto returning a data.frame?
...e. Does anyone have a good example (from some of the packages?) for returning a data.frame. I'm trying to start my function so that it takes a data.frame as an argument and returns a data.frame (post-hocus-pocus). Here's my function so far... SEXP testfunction3( SEXP m_in ) { int *mdims, n, p, i; double *mm; SEXP m_out; SEXP nms; if( !isMatrix( m_in ) ) { error("m_in must be a matrix"); } mdims = INTEGER( GET_DIM( m_in ) ); n = mdims[0]; p = mdims[1]; PROTECT( m_out = NEW_NUMERIC( p ) ); PROTECT( m_in = AS_NUMERIC( m_in ) );...
2001 Dec 14
2
colSums in C
Hi, all! My project today is to write a speedy colSums(), which is a function available in S-Plus to add the columns of a matrix. Here are 4 ways to do it, with the time it took (elapsed, best of 3 trials) in both R and S-Plus: m <- matrix(1, 400, 40000) x1 <- apply(m, 2, sum) ## R=16.55 S=52.39 x2 <- as.vector(rep(1,nrow(m)) %*% m) ## R= 2.39 S= 8.52 x3 <-
2005 Jul 21
4
RandomForest question
Hello, I'm trying to find out the optimal number of splits (mtry parameter) for a randomForest classification. The classification is binary and there are 32 explanatory variables (mostly factors with each up to 4 levels but also some numeric variables) and 575 cases. I've seen that although there are only 32 explanatory variables the best classification performance is reached when