similar to: colSums in C

Displaying 20 results from an estimated 8000 matches similar to: "colSums in C"

2003 Feb 13
1
colSums etc. documentation (PR#2545)
For your consideration: > z [,1] [,2] [1,] 1 NA [2,] 2 NA [3,] 3 NA > colSums(z) [1] 6 NA Correct, according to the documentation > colSums(z,na.rm=T) [1] 6 0 Surprising to me, but, as documented, correctly consistent with apply() and >sum(NULL) [1] 0 The documentation for sum() explicitly notes that the sum of an empty set is 0 by definition, so that users
2003 Sep 14
1
Documentation of colSums et. al (PR#4154)
Full_Name: Doug Grove Version: 1.7.0 OS: Linux Submission from: (NULL) (209.31.211.56) Hi, Minor mistake in the documentation on the colSums page. In the ARGUMENTS section it states for 'dims' that: For `col*', the sum or mean is over dimensions `dims+1, ...'; for `row*' it is over dimensions `1:dims'. These two are reversed. Thanks, Doug Grove
2003 Dec 30
1
Accuracy: Correct sums in rowSums(), colSums() (PR#6196)
Full_Name: Nick Efthymiou Version: R1.5.0 and above OS: Red Hat Linux Submission from: (NULL) (162.93.14.73) With the introduction of the functions rowSums(), colSums(), rowMeans() and colMeans() in R1.5.0, function "SEXP do_colsum(SEXP call, SEXP op, SEXP args, SEXP rho)" was added to perform the fast summations. We have an excellent opportunity to improve the accuracy by
2005 Apr 21
1
colSums and rowSums with arrays - different classes and dim ?
Hi, I'm using colSums and rowSums to sum the first dimensions of arrays. It works ok but the resulting object is different. See > a3d <- array(rnorm(120, mean=2), dim=c(20,6,1)) > dim(colSums(a3d)) [1] 6 1 > dim(rowSums(a3d)) NULL > class(colSums(a3d)) [1] "matrix" > class(rowSums(a3d)) [1] "numeric" I was expecting rowSums to preserve the array
2010 Nov 28
4
how to divide each column in a matrix by its colSums?
Hi, I have a matrix, say m=matrix(c( 983,679,134, 383,416,84, 2892,2625,570 ),nrow=3 ) i can find its row/col sum by rowSums(m) colSums(m) How do I divide each row/column by its rowSum/colSums and still return in the matrix form? (i.e. the new rowSums/colSums =1) Thanks. Casper -- View this message in context:
2002 Jan 07
0
New package: colSums
I've uploaded a package colSums_1.0.tar.gz to CRAN /src/contrib/Devel. It contains functions colSums, colMeans, colVars, colStdevs, rowSums, rowMeans, rowVars, and rowStdevs. These do simple, fast arithmetic on columns/rows of a matrix, or more generally across dimensions of an array, e.g. colSums(m) = apply(m, 2, sum) but faster. They should be compatible with the corresponding S-Plus
2009 Nov 30
2
command similar to colSums for rowSums?
Working with an NxMxO sized matrix, currently I can do this in my code: if (max(colSums(array)) >= number) But to get an equivalent result using rowSums, I have to do: for (i in 1:10) { if (max(rowSums(array[,,i])) >= number) } I'm running both in a much larger loop that loops millions of times, so speed and such is quite a big factor for me. Currently, the colSums line uses about
2002 Jan 07
1
Is r-announce alive?
I sent a message to <r-announce at stat.math.ethz.ch> last Thursday ("New package: colSums"), and still haven't seen it echoed on r-help or on the web archive (in fact there is no r-announce web archive for 2002). Is something broken? Did I need to use <r-announce at lists.R-project.org> instead? -- -- David Brahm (brahm at alum.mit.edu)
2003 May 21
2
moving onto returning a data.frame?
I've been studying some of the code and I'm still a little shakey on the proper method for returning a data.frame from a C function (which is my ultimate goal here). I've started some code that I've "stolen" from the archives and I'm running into crashes, etc. I've been trying to gleen some insight from the src/main/scan.c file and didn't find many comments in
2009 Dec 24
3
Newbie: colSums() compared with Matlab's sum()
Hi all, I'm trying to learn R after years of Matlab's experience. Here is an issue I couldn't solve today. Consider the following piece of code (written by memory): for(i in 1:n){ submat <- data[1:i,] C <- colSums(submat) } The problem is that at the first iteration, data[1:1,] reduces to a vector and colSums returns an error. This sounds really strange to me
2001 Jul 18
1
colSums
As best I understand it, colSums (and associated functions) in S+ 6 are optimized functions (calling special C routines) for doing simple matrix math. For example, it seems like (in S+): all.equal(colSums(m), apply(m, 2, sum)) should be TRUE for any matrix m. It also seems like colSums (and its brethren) are very fast. My question: Are there equivalents to colSums in R? Thanks, Dave Kane
2011 Aug 14
3
Not sure how to use aggregate, colSums, by
I have a data frame called test shown below that i would like to summarize in a particular way : I want to show the column sums (columns y ,f) grouped by country (column e1). However, I'm looking for the data to be split according to column e2. In other words, two tables of sum by country. One table for "con" and one table for "std" shown in column e2. Finally at the
2004 Jun 09
1
Re: R equivalent of Splus rowVars function
Mark Leeds <mleeds at mlp.com> wrote (to S-News): > does anyone know the R equivalent of the SPlus rowVars function ? Andy Liaw <andy_liaw at merck.com> replied: > More seriously, I seem to recall David Brahms at one time had created an R > package with these dimensional summary statistics, using C code. (And I > pointed him to the `two-pass' algorithm for variance.)
2001 Oct 03
8
Several R vs S-Plus issues
Hi, all, I've been converting code from S-Plus ("S" for short) to R for a few weeks. Here are some differences I've found, aside from the big well-known ones (scoping, models, data storage) and the contents of Kurt Hornik's FAQ section 3.3.3. Let me start with the ones that seem like serious bugs or deficiencies: 1) LETTERS[c(NA,2)] in S is
2001 Oct 03
8
Several R vs S-Plus issues
Hi, all, I've been converting code from S-Plus ("S" for short) to R for a few weeks. Here are some differences I've found, aside from the big well-known ones (scoping, models, data storage) and the contents of Kurt Hornik's FAQ section 3.3.3. Let me start with the ones that seem like serious bugs or deficiencies: 1) LETTERS[c(NA,2)] in S is
2007 Apr 16
1
colSum() in Matrix objects
Hi, I'd like to simply add column-wise using Matrix objects (Csparse). It looks like one can apply mosty any base function to these objects (i.e., apply, colSums), but there is a nasty conversion to traditional matrix objects if one does that. Is there any workaround? I can see colSum listed in the help for Class 'CsparseMatrix' , but I wonder whether I'm using the default
2002 Aug 14
3
t-test via matrix operations
I need to calculate a large number of t statistics, and would like to do so via matrix operations. So far I have figured out a way to calculate the mean of each row of the matrix: d <- matrix(runif(100000,1,10), 1000, 10) # some test data s <- rep(1,ncol(d)) # a sum vector to use for matrix multiplication means <- (d%*%s)/ncol(d) This is at least 1 order of magnitude faster than
2002 Nov 15
2
Why no colSDs etc
Hi people, If there is a fn "colMeans" why isn't there a "colSDs" etc Thanks, Phil. -- Philip Rhoades Pricom Pty Limited (ACN 003 252 275) GPO Box 3411 Sydney NSW 2001 Australia Mobile: +61:0411-185-652 Fax: +61:2:8923-5363 E-mail: pri at chu.com.au -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2002 Mar 17
5
compute variance of every column in a matrix without a loop
Is it possible to compute the variance of every column in a matrix without a loop? -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
2015 May 21
3
Fix for bug in arima function
On 21 May 2015, at 12:49 , Martin Maechler <maechler at lynne.stat.math.ethz.ch> wrote: >>>>>> peter dalgaard <pdalgd at gmail.com> >>>>>> on Thu, 21 May 2015 11:03:05 +0200 writes: > >> On 21 May 2015, at 10:35 , Martin Maechler <maechler at lynne.stat.math.ethz.ch> wrote: > >>>> >>>> I noticed that