similar to: Means from selected columns in a data frame

Displaying 20 results from an estimated 6000 matches similar to: "Means from selected columns in a data frame"

2012 Dec 24
2
colmeans not working
[text file is also attached in case you find the format of email difficult to understand] Dear useRs,You must all the planning for the christmas, but i am stucked in my office on the following issue i had a file containg information about station name, year, month, day, and discharge information. i opened it by using following command > dat1<-read.table("EL.csv",header=TRUE,
2006 Aug 16
3
separate row averages for different parts of an array
I have an array with 44800 columns and 24 rows I would like to compute the row average for the array 100 columns at a time, so I would like to end up with an array of 24 rows x 448 columns. I have tried using apply(dataset, 1, function(x) mean(x[])), but I am not sure how to get it to take the average 100 columns at a time. Any ideas would be welcomed. thanks, Spencer [[alternative HTML
2010 Jun 01
2
Problem using apply
Hello , I can not get apply function to do what I want when doing stuff on rows. Let's say I want to divide the rows of matrix by their mean, the below show you get the same result weather you use 1 or 2, i.e. same result for columns than for means..:( Thanks a lot for the help, m = matrix( c(1,4,7,4,5,8,7,8,9), nrow = 3 ) divideByMean = function( v ){ return(
2011 Sep 20
1
means across list of data frames
I have a list of data frames like the following: set.seed(123) a<- data.frame(x=runif(10), y = runif(10), sample = seq(1,10)) b<- data.frame(x=runif(10), y = runif(10), sample = seq(1,10)) L<- list(a,b) All data frames in the list have the same dimensions. I need to calculate the sample means for x and y. The real data are lists of several thousand quite large dataframes, so I need
2012 Jan 11
3
summarizing a complex dataframe
I need some help summarizing complex data frames (small example below): m1_1 m2_1 m3_1 m1_2 m2_2 m3_2 i1 1 1 1 2 2 2 i1 2 1 1 2 2 2 i2 2 2 1 2 2 2 For an arbitrary number of columns (say m1 ?. m199) where the column names have variable patterns, and such that each set of columns is repeated (with potentially unique data) an
2011 Dec 19
2
Summing x1 to x6
Suppose I have the following: x1<-as.vector(rnorm(10)) x2<-as.vector(rnorm(10)) x3<-as.vector(rnorm(10)) x4<-as.vector(rnorm(10)) x5<-as.vector(rnorm(10)) x6<-as.vector(rnorm(10)) x7<-as.vector(rnorm(10)) x8<-as.vector(rnorm(10)) x9<-as.vector(rnorm(10)) x10<-as.vector(rnorm(10)) I would like the mean of x1 to x6 for each vector position. I would do something else
2009 Jul 13
1
Add grand mean to every entry in a matrix
Hi, I have a matrix: mymat <- matrix(runif(10*4), ncol=4) I wish to subtract the column means, down the colums, subtract the row means from the rows and add back the grand mean - all the means should be the means of mymat rather than of the new matrix. How can I do this? Any help much appreciated. Thanks Tom _________________________________________________________________
2008 Oct 17
2
function help
Hi everyone, I have dataset which I make a sample of it couple of times and each time I get the mean and standard deviation of each row for each sample. I have a function for that, which takes the name of the file and number of times to sample and then returns the mean and standard deviation for each row in each sample. Sample=function(name, n){
2009 Jul 08
1
heatmap.2: question regarding the "raw z-score"
Hi, I am analysing gene expression data using the heatmap.2 function in R and I was wondering what is the formula of the "raw z-score" bar which shows the colors for each pixel. According to that post: https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html, it is the (actual value - mean of the group) / standard deviation. But, mean of which group? Mean of the gene
2006 Sep 07
2
Matrix package in R-2.4.0alpha
In a newly downloaded version (today) of R-2-4-0alpha, with all packages from CRAN also installed today, I get: > library(Matrix) Erro en loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'Matrix' methods specified for export, but none defined: BIC, anova, coef, confint, deviance, fitted, fixef, formula, head, lmer, logLik, mcmcsamp, plot,
2006 Feb 28
2
Elegant way to express residual calculation in R?
Hi All, I am illustrating a simple, two-way ANOVA using the following data and I'm having difficulty in expressing the predicted values succinctly in R. X<- data.frame(read.table(textConnection(" Machine.1 Machine.2 Machine.3 53 61 51 47 55 51 46 52 49 50
2005 Dec 14
4
unable to force the vector format
Dear all, I am so ashamed to pollute the list with a trivial question, but it is a long time I have not used R, and I need a result in the next one or two hour... I have a table which I have loaded with read.table, and I want to make the mean of its columns. > slides <- read.table("slides.txt") > slides [1:5,] V1 V2 V3 V4 V5 V6 V7 V8 1
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
2011 May 13
4
Quick question: Omitting rows and cols with certain percents of missing values
Hi naive question. It is possible to get R command for omitting rows or cols with missing values present. But if i want to omit rows or cols with i.e . >20% missing values, I could´t find any package-based command, probably because it is too simple for anyone to do that manually, though not for me. Can anyone please help me ? - vickie [[alternative HTML version
2012 Apr 19
4
Column(row)wise minimum and maximum
Hi, Currently, the "base" has colSums, colMeans. It seems that it would be useful to extend this to also include colMin, colMax (of course, rowMin and rowMax, as well) in order to facilitate faster computations for large vectors (compared to using apply). Has this been considered before? Please forgive me if this has already been discussed before. Thanks, Ravi Ravi Varadhan, Ph.D.
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
2006 Dec 10
1
Problem with loading "library(Matrix)" at Ubuntu
Dear All, After upgrading to R-2.4.0-dapper2 (my system is ubuntu 6.06 LTS), I often met problems when loading some packages like Matrix. Here is the details: > library(Matrix) Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'Matrix' methods specified for export, but none defined: Arith, Math, Math2, +, %*%, Schur, as.matrix, chol,
2011 Jul 19
3
calculating the mean of a random matrix (by row) and some general questions
Hi everyone! I'm trying to teach myself R in order to do some data analysis. I'm a mathematics student and (only) familiar with matlab and latex. I'm working trough the "official" introduction to R at the moment, while simultaneously solving some exercises I found in the web. Before I post my (probably stupid) question, I'd like to ask you for some general advice. How do
2008 Oct 16
2
saving result of a "for" loop
Hi everyone, I have dataset which I take random samples of it 5 times. each time I get the mean for rows for each sample. at the end I need to calculate the Average of all means for each sample and each row. to clear it up I give an example: say this is my dataset. X8 X9X10X12 X13 X14 X15 X16X17X18X19 X20 X21 X22 s1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 s2 0 0 0
2015 Nov 17
2
Borrar cada fila 400
Gracias Carlos una vez más, pero no es exactamente lo que quiero Con colMeans estas calculando por columnas, pero yo quiero que calcule asi: mean(datos[1:20,1:20]), pero claro, para toda la secuencia. mean(datos[1:20,1:20]) me devuelve el error-> Error in datos[1:2, 1:2] : object of type 'closure' is not subsettable Date: Tue, 17 Nov 2015 18:34:59 +0100 Subject: Re: [R-es]