Displaying 20 results from an estimated 3000 matches similar to: "rowVars"
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 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.)
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
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 28
4
Functions on matrix row level
Hi together,
I have some data in a matrix structure - say 1000 rows with 10 columns. And
I like to do some calculations (like max, avg or min) on row level.
The only solution I found so fare was using a loop like
for (i in 1:1000) {
max[i] <- max(matrix[I,])
}
It looks like that this is not very fast.
Does an other way exists?
Kind regards
Ulrich
2000 Jul 07
1
reorganizing a data frame
Hi,
I have what I think is an easy question.
I have a data frame, called stockdata, of stock prices that looks like this:
date ticker close
1 01/02/1998 GE 24.667
2 01/05/1998 GE 25.104
3 01/06/1998 GE 24.771
4 01/07/1998 GE 24.979
5 01/08/1998 GE 24.750
6 01/02/1998 HIT 71.125
7 01/05/1998 HIT 72.313
2007 Mar 09
1
lpSolve space problem in R 2.4.1 on Windows XP
Hi.
I am trying to use the linear optimizer from package lpSolve in R 2.4.1 on
Windows XP (Version 5.1). The problem I am trying to solve has 2843
variables (2841 integer, 2 continuous) and 8524 constraints, and I have 2 Gb
of memory. After I load the input data into R, I have at most 1.5 Gb of
memory available. If I start the lp with significantly less memory
available (say 1 Gb), I get
2007 Jul 12
1
sub-function default arguments
Hi.
I have defined a function, f1, that calls another function, f2. Inside f1
an intermediate variable called nm1 is created; it is a matrix. f2 takes a
matrix argument, and I defined f2 (schematically) as follows:
f2<-function(nmArg1=nm1,...){nC<-ncol(nmArg1); ... }
so that it expects nm1 as the default value of its argument. f1 is defined
(schematically) as:
2009 Sep 20
4
correlation help
Dear group,
I have a matrix like the following:
Name Sample1 sample2 sample3 sample4 ..... sample(n)
nm1 10.5 13.5 30 31
nm2 8 11 34 29
nm3 9 10.3 27.8 35
nm(j)
I want to be able to calculate correlation between all pairs of names.
For example (nm1,nm2),
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
2009 Mar 13
2
Taking diff of character vectors
Hello, everybody
Say I have
nm1 <- c(rep(1,10), rep(0,10))
then I can do:
diff(nm1)
to see where I have shift in value
but what if I have
nm2 <- c(rep("SPZ8", 10), rep("SPX9", 10))
how can I produce the same ouput as diff(nm1) does, that is zeros
everywhere except for one place where SPZ8 changes to SPX9 (there
should be 1 there)?
What if I have a matrix of characters
2016 Dec 20
2
colnames for data.frame could be greatly improved
Hello,
colnames seems to be not optimized well for data.frame. It escapes
processing for data.frame in
if (is.data.frame(x) && do.NULL)
return(names(x))
but only when do.NULL true. This makes huge difference when do.NULL
false. Minimal edit to `colnames`:
if (is.data.frame(x)) {
nm <- names(x)
if (do.NULL || !is.null(nm))
return(nm)
else
2007 Mar 01
2
Row-wise two sample T-test on subsets of a matrix
Hello all,
I am trying to run a two sample t-test on a matrix which is a
196002*22 matrix. I want to run the t-test, row-wise, with the
first 11 columns being a part of the first group and columns
12-22 being a part of the second group.
I tried running something like (temp.matrix being my 196002*22
matrix)
t.test(temp.matrix[,1:11],temp.matrix[,12:22],paired=TRUE)
or somthing like
2006 Aug 18
2
Floating point imprecision in sum() under R-2.3.1?
After upgrading to R-2.3.1 on Linux Redhat, I was suprised by this:
R> x <- c(721.077, 592.291, 372.208, 381.182)
R> sum(x) - 2066.758
[1] 4.547474e-13
Now I understand that floating point arithmetic is not precise, but
1) the result is exactly 0 in R-2.2.1 (patched) on the same machine,
2) .Machine$double.eps = 2.2e-16, so the error seems quite large.
Also note I get the same
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
2002 Jul 02
3
mean and array
In general this is what "apply" does. In your example you could use
rowMeans(ar) as well, I think.
Reid Huntsinger
-----Original Message-----
From: Olivier Martin [mailto:olivier.martin at inrialpes.fr]
Sent: Tuesday, July 02, 2002 10:55 AM
To: r-help
Subject: [R] mean and array
Hi all,
I have an array, one say ar, with 3 dimensions.
dim(ar)
>200 3 4
I would like to
2005 Mar 09
2
Question about biasing in sd()???
Hi,
Can anyone help me with the following. I have been using R for Monte
Carlo simulations and got some results I couldn't explain. Therefor I
performed following short test:
--------------
mean.sds <- NULL
sample.sizes <- 3:30
for(N in sample.sizes){
dum <- NULL
for(I in 1:5000){
x <- rnorm(N,0,1)
dum <- c(dum,sd(x))
}
mean.sds<- c(mean.sds,mean(dum))
}
2001 Oct 22
3
round() doesnt (PR#1138)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._