Displaying 20 results from an estimated 4000 matches similar to: "Documentation of colSums et. al (PR#4154)"
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 <-
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
2005 Oct 20
3
numerical issues in chisq.test(simulate=TRUE) (PR#8224)
Hi,
This report deals with p-values coming from chisq.test using
the simulate.p=TRUE option. The issue is numerical accuracy
and was brought up in previous bug reports 3486 and 3896.
The bug was considered fixed but apparently was only mostly
fixed. Just the typical problem of two values that are
mathematically equal not ending up numerically equivalent.
Consider this series of three 2x2
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
2004 Jun 25
3
alternate rank method
Hi,
I'm wondering if anyone can point me to a function that will
allow me to do a ranking that treats ties differently than
rank() provides for?
I'd like a method that will assign to the elements of each
tie group the largest rank.
An example:
For the vector 'v', I'd like the method to return 'rv'
v: 1 2 3 3 3 4 5 5 6 7
rv: 1 2 5 5 5 6 8 8 9 10
Thanks,
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
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
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.)
2005 Sep 08
1
Wishlist: write.delim()
Hi,
It would be great if someone would add write.delim() as an
adjunct to write.table(), just as with write.csv().
I store a lot of data in tab-delimited files and can read
it in easily with: read.delim("text.txt", as.is=TRUE)
and would love to be able to write it out as easily when
I create these files.
The obvious setting needed for write.delim() is sep = "\t",
but in
2006 Jul 18
1
documentation for argument to screen (PR#9085)
Full_Name: Doug Grove
Version: 2.3.1 patched (2006-07-03 r38485)
OS: Windows
Submission from: (NULL) (24.19.37.159)
A msg. to R-help prompted me to read the help page for split.screen/screen,
etc.
I understand what the function is for, but could not find information that
described how the argument 'n' in screen/erase.screen/close.screen is mapped to
the regions on the device. All we
2009 Dec 04
1
error in help.search (PR#14113)
Full_Name: Doug Grove
Version: 2.10.0 10-26-2009
OS: x86_64-unknown-linux-gnu
Submission from: (NULL) (140.107.164.65)
Hi,
Looks like the revisions to help.search didn't get completely finished.
When the user specifies the argument 'package' the code doesn't define the
variable 'paths' prior to trying to use it, which obviously produces an error.
The code dies when
2003 Jan 22
1
dataframe subsetting behaviour
Hi,
I'm trying to understand a behaviour that I have encountered
and can't fathom.
Here's some code I will use to illustrate the behaviour:
# start with some data frame "a" having some named columns
a <- data.frame(a=rep(1,3),c=rep(2,3),d=rep(3,3),e=rep(4,3))
# create a subset of the original data frame, but include a
# name "b" that is not present in my
2004 Oct 21
3
documentation for rank() (PR#7298)
Full_Name: Doug Grove
Version: R.1.9.1
OS: Linux
Submission from: (NULL) (140.107.156.61)
I just found that rank() has a 'decreasing' argument that is not documented in
its
help page. I checked my version of 2.0.0 (original release hence unpatched)
and
it is not documented there. For curiousity I also went back to version 1.8.1
and
checked the function (not the documentation)and at
2002 Oct 28
1
R-1.6.0 crashing on RedHat6.3
Hi,
I'm having what I believe are OS problems with my installation
of R-1.6.0. The machine I'm using was previously running R-1.4.0.
The install seemed fine to me. I didn't note an error messages
in 'make' or 'make check'.
My problem is that I've been running some memory intesive code,
and the code that ran under 1.4.0 but won't run under R.1.6.0
(or under
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
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)
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
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: