search for: columnwise

Displaying 20 results from an estimated 45 matches for "columnwise".

Did you mean: columnist
2006 Jun 23
2
columnwise multiplication?
Hi all, I'd like to do a multiplication between 2 matrices buy only want resulsts of cloumn 1 * column 1, column 2 * column 2 and so on. Now I do C <- diag(t(A) %*% B) Is there a bulit in way to do this? Thank you. [[alternative HTML version deleted]]
2002 Mar 21
5
repeating rows or columns within a matrix
Hello Spse I have a matrix, say 1 2 3 4 5 6 7 8 9 and I would like to expand it by repeating rows within the matrix, to get, if the repeating factor is 2, say: 123 123 456 456 789 789 (or columnwise as well) . There must be a smart way of doing that? Many thanks Juhana Vartiainen juhana.vartiainen at labour.fi -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", &qu...
2002 Mar 30
2
Inconsistency among mean, median, max, var
I found a strange inconsistency: If m is a matrix and d is a data frame then - mean(m), median(m), max(m) and max(d) all return a single value but - mean(d) returns the column means - median(d) fails - both var(m) and var(d) return the variance covariance matrix You pretty much have to experiment to figure this out since much of this behavior is not readily obvious from the help files.
2011 Feb 07
1
Unusual slowing of R matrix multiplication version 2.12.1 (2010-10-15) vs 2.12.0
...essor Mac: > source("http://www.bio.umass.edu/biology/kunkel/pub/R/CuriousResult.R") matrix multiplication 43.543 1.308 14.788 tcrossprod 41.147 1.286 11.9 transposition and reuse 40.407 3.525 43.606 elementwise after reshape 21.474 1.828 23.124 columnwise sapply 34.695 32.35 66.592 for loop over columns 37.237 29.471 67.2 On the same day upgrading to 2.12.1 on the same dual core dual processor Mac: > source("http://www.bio.umass.edu/biology/kunkel/pub/R/CuriousResult.R") matrix multiplication 256.775 2.178 2...
2010 Oct 19
2
head.matrix() unintelligent
...Just a simple question really. I?ve got these large 2d matrices that I?d like to inspect, but not from start to finish. The head() command is convenient when columns are few. For large nxn matrices, however, head() and head.matrix() are still cumbersome. Is there a simple way of viewing both the columnwise and rowwise heads of a matrix? cheers, Bruce -- View this message in context: http://r.789695.n4.nabble.com/head-matrix-unintelligent-tp3002346p3002346.html Sent from the R help mailing list archive at Nabble.com.
1998 Sep 25
1
format(numericmatrix, ...) : proposal for a change
...t; 6 " " 0.9540261 " [7,] " 7 " "-0.4660654 " (which is different from the above apply(...) by using strings which all have the identical number of characters). Proposal: I'd like to have format(<numeric matrix>, ...) change to do COLUMNWISE formatting, either the way as apply(..) above, or returning strings of identical length (somewhat like S above). Note I don't intend to copy S-plus' ``full mess'' of doing it : In S-plus format(aa) and format(aa, digits = .Options$digits) are very different even though .Optio...
2009 Dec 17
2
Exchange NAs for mean
.... I'm trying to exchange all missing values in a column by the column mean using the code below, but so far, nothing happens with the NAs... Can anyone see where the problem is? N<-nrow(X) # Calculate number of rows = 108 p<-ncol(X) # Calculate number of columns = 88 # Replace by columnwise mean for (i in colnames(X)) # Do for all columns in the matrix { for (j in rownames(X)) # Go through all rows { if(is.na(X[j,i])) # Search for missing value in the given position { X[j,i]=mean(X[1:p, i]) # Change missing value to the mean of the column } } }...
2011 Sep 06
2
subsetting tables
Hi guys, one of the questions where you need a real human instead of a search engine, so it would be great if you could help. I have a matrix of z-scores which I would like to filter, sometimes columnwise, sometimes rowwise. Data looks like this: Allstar hsa.let.7a hsa.let.7a.1 hsa.let.7a.2 2 0.87 0.79 -0.57 1.07 3 0.67 -1.14 -0.78 -0.95 4 -0.46 -0.30 -0.36 1.14 Now I want to find all elements which are below/above some threshol...
2001 Dec 08
2
Building under IRIX 6.5 (report)
....lo) $(SOURCES_F:.f=.lo) # $(SOURCES_BLAS:.f=.lo) HEADERS = Lapack.h ------------ make stops with the following error: "cmplx.f", line 19283: warning(2290): actual argument is incompatible with dummy argument CALL ZLARFB( SIDE, TRANS, 'Forward', 'Columnwise', MI, NI, ^ don't know how to make # (bu42). *** Error code 1 (bu21) *** Error code 1 (bu21) *** Error code 1 (bu21) *** Error code 1 (bu21) ------------ configure: R is now configured for mips-sgi-irix6.5 Source directory:...
2006 Nov 13
1
Question on applying vectors to data.frames by row
...ply the rows in a dataframe by a vector. # However, the default behavior appears to be for the vector to be applied # column wise. For example: vct <- 1:4 df <- data.frame(c1 = 5:10, c2= 6:11, c3=7:12, c4=8:13) multTheTwo <- vct * df multTheTwo # This results in the vector getting cycled columnwise # c1 c2 c3 c4 # 1 5 18 7 24 # 2 12 28 16 36 # 3 21 8 27 10 # 4 32 18 40 22 # 5 9 30 11 36 # 6 20 44 24 52 # But what I actually want is: # c1 c2 c3 c4 #1 5 12 21 32 which is 5*1, 6*2, 7*3, 8*4 #2 6 14 24 36 same pattern applied to the next row #3 7 16 27 40 so on .... #4 8 18 3...
2005 Jan 03
1
row ("FORTRAN") order?
Reading about 'R_max_col' in "Writing R extensions", Version 2.1.0,(2005-01-03), I find: "Given the nr by nc matrix matrix in row ("FORTRAN") order, ..." Looks like a contradiction to me, since FORTRAN stores matrices columnwise. So is this a documentation bug? -- G?ran Brostr?m tel: +46 90 786 5223 Department of Statistics fax: +46 90 786 6614 Ume? University http://www.stat.umu.se/egna/gb/ SE-90187 Ume?, Sweden e-mail: gb@stat.umu.se
2008 Jun 18
4
inverse cumsum
I've a matrix like this: 1985 1.38 1.27 1.84 2.10 0.59 3.47 1986 1.05 1.13 1.21 1.54 0.21 2.14 1987 1.33 1.21 1.77 1.44 0.27 2.85 1988 1.86 1.06 2.33 2.14 0.55 1.40 1989 2.10 0.65 2.74 2.43 1.19 1.45 1990 1.55 0.00 1.59 1.94 0.99 2.14 1991 0.92
2007 Mar 04
1
Scoping issue?
Hello, The code below is supposed to be a wrapper for matplot to do columnwise visible comparison of several matrices, but I'm doing something wrong because I can't access an argument called 'colnum'. I'd be most grateful for some insight. Thanks, John Thaden Little Rock, AR ################################ # mmatplot is a matplot wrapper to compare the...
2010 Nov 18
0
On efficiency, Vectorize and loops
...nd b<-1 # Upper bound p<-5 # [See Bathia, Yao, Ziegelmann p. 5) ####################################### # Building the error function 'epsilon' ####################################### # Building the vector process 'Z' (which is a iiN(0,I_d) vector process) # Time varies columnwise Z<-matrix(rnorm(10*n),nrow=10,ncol=n) # Defining the deterministic base functions 'zeta' zeta<-function(u,i){ sqrt(2)+sin(pi*i*u) } zeta2<-function(i){force(i); function(u){ sqrt(2)+sin(pi*outer(i,u)) } } zeta3<-function(u,i){ sqrt(2)+sin(pi*outer(i,u)) } # Bui...
2011 Dec 21
1
matrix multivariate bootstrap: order of results in $t component
....6962 -0.34420 8.432 0.15738 0.01 -0.1798 -1.361 -0.5881 -1.00317 5.656 -0.02612 0.08 1.0907 -1.086 -0.4583 -0.08596 2.642 0.57025 > ?boot doesn't say how these are strung out to give the 1 x 18 vector in each row of lboot$t, but I believe it is done columnwise -- is this correct? That is, I think that the column names for the bootstrap results, lboot$t, should vary most quickly down the columns: > c(t(outer(colnames(lboot$t0), rownames(lboot$t0), paste, sep=':'))) [1] "GNP:0.00" "GNP:0.01" "GN...
2010 Oct 08
3
Import Multiple csv files and merge into one Master file
Dear R Group: How to import multiple csv files and merge into one dataset. Thanks and Regards, Xing [[alternative HTML version deleted]]
2005 Jan 16
1
p.adjust(<NA>s), was "Re: [BioC] limma and p-values"
...ot;bh" but kept "fdr" as a synonym for backward compatability. 3. Upper case values for method "BH" or "YH" are also accepted. 4. p.adust() now preserves attributes like names for named vectors (as does cumsum and friends for example). 5. p.adjust() now works columnwise on numeric data.frames (as does cumsum and friends). 6. method="hommel" now works correctly even for n=2 7. The 'n' argument is removed. Setting this argument for any methods other than "none" or "bonferroni" make the p-values indeterminate, and the argume...
2009 Mar 12
8
help with loop
Dear useRs, I'm trying to write a loop to sum my data in the following way: (the second - the first) + (the third - the second) + (the fourth - the third) + ... for each column. So, I wrote something like this:   c <- list()   for(i in 1:ncol(mydata)) {   for(j in 2:nrow(mydata)) {   c[[i]] <- sum(yc[j,i] - yc[(j-1),i])   }}} As for the columns it works pretty fine, but it only
2000 Sep 23
3
bug in apply with median
I have found a problem in R version 1.1.1 when using apply with the median function. The problem can be illustrated with the following data matrix: X1 X2 X3 1 2 3 4 5 6 7 8 NA Enter this data matrix as X and then try apply(X,2,median,na.rm=T) The problem here is that the median function returns a named scalar if the number of observations is odd, but returns an
2007 Feb 22
1
how to show date with this subset
Dear List, Thankyou to Jim and Marc for their help on my previous question. I have a data frame of five columns, the first being a list of dates and the other four columns are numeric values. I wanted to list the days where all 4 columns of values are less than in the previous row. I used the following which works fine, except it doesnt show the dates for each row (the values from column 1).