similar to: Averaging rows if a condition is true.

Displaying 20 results from an estimated 2000 matches similar to: "Averaging rows if a condition is true."

2010 Jan 25
3
binary
Hi all Assume I have a data set xx; Group: 1=group1 ?, 2=group2 IQ: ?1= High, 0 =low fit <- glm(IQ ~group, data = xx, family = binomial()) summary(fit) Results ?????? ????????????Estimate Std. Error z value Pr(>|z|) (Intercept) -2.55456??? 0.210 -12.273? < 5e-16 *** group????????? 0.36180 ?????0.076?? 3.952 ????5.24e-05 *** the odd ratio = exp(0.36180 )= 1.435912 My question
2009 Sep 09
2
How to sum and group data by DATE in data frame
Dear all, Lets say I have a data frame as follows: > Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13', '2006-09-20')) > Income <- c(73.79, 72.46, 76.32, 72.43, 72.62) > data.frame(Date, Income) Date Income 1 2006-08-23 73.79 2 2006-08-30 72.46 3 2006-09-06 76.32 4 2006-09-13 72.43 5 2006-09-20 72.62 >
2010 May 05
2
t.test per line
Dear All, I apologize for this trivial question, I can not find the solution I try to use t.test function per line in the data.frame, But i dont'understand the error message my program is as follows group1<-gl(2,20) fun<-function(x){ m<-data.frame(group1,x) #anova(aov(x ~ group1, m)) t.est(x ~ group1,m) } ttest<- apply(data, 1, fun) Error in t.test.default(x = c(1, 1,
2013 Mar 15
3
reviewer comment
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20130315/7300f19c/attachment.pl>
2009 Nov 11
2
Error in lm() function
Hi all, I wanted to have a seasonality study like whether a particular month has significant effect as compared to others. Here is my data : 0.10499 0 0 1 0 0 0 0 0 0 0 0 0.00259 0 0 0 1 0 0 0 0 0 0 0 -0.06015 0 0 0 0 1 0 0 0 0 0 0 0.10721 0 0 0 0 0 1 0 0 0 0 0 0.03597 0 0 0 0 0 0 1 0 0 0 0 0.10584 0 0 0 0 0 0 0 1 0 0 0 0.02063 0 0 0 0 0 0 0 0 1 0 0 -0.03509 0 0 0 0 0 0 0 0 0 1 0 -0.03485 0 0 0
2009 Aug 26
4
Select top three values from data frame
Hi, I'm trying to find an easy way to do this. I want to select the top three values of a specific column in a subset of rows in a data.frame. I'll demonstrate. A B C x 2 1 x 4 1 x 3 2 y 1 5 y 2 6 y 3 8 I want the top 3 values of B from the data.frame where A=X and C <2 I could extract all the rows where C<2, then sort by B, then take
2010 Apr 30
3
Find solution for an error in the condition of if
Dear r-help, Could you help me to find a solution for this error: Il y a eu 50 avis ou plus (utilisez warnings() pour voir les 50 premiers) > warnings() Messages d'avis : 1: In if ((data[pa, k] == df[, j]) & (data[ch, k] == i)) { ... : la condition a une longueur > 1 et seul le premier élément est utilisé 2: In if ((data[pa, k] == df[, j]) & (data[ch, k] == i)) { ... : la
2010 May 25
4
R eat my data
HI, Dear R community, My original file has 1932 lines, but when I read into R, it changed to 1068 lines, how comes? cdu@nuuk:~/operon$ wc -l id_name_gh5.txt 1932 id_name_gh5.txt > gene_name<-read.table("/home/cdu/operon/id_name_gh5.txt", sep="\t", skip=0, header=F, fill=T) > dim(gene_name) [1] 1068 3 -- Sincerely, Changbin -- Changbin Du DOE Joint Genome
2010 Feb 17
2
Is the aggregate function the best way to do this?
Hi, I''m having a dataframe ''Subset1'' with a number of factor variables and 160 numerical variables Now I want to make sums for all rows that have the same values for the different factor variables, except for the factor variables: VAR1,VAR2,VAR3 who may have the same values. With the formula given below this works great, but in a situation with 15000 rows and 13
2011 May 25
1
transpose ?
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20110525/acc78a27/attachment.pl>
2008 Jul 15
2
Problem installing R on openSUSE 10.3
Dear All, I am trying to install R 2.7 on my openSUSE 10.3. I have faithfully followed instruction at http://cran.r-project.org/bin/linux/suse/ReadMe.txt. I have downloaded all the RPMs but still R complains about: libtcl8.4.so is needed by R-base-2.7.1-6.1.i586 I searched for this library and found a one, tcl-8.4.15-22.i586.rpm at openSUSE distribution site and installed. But R still complains
2010 Apr 14
6
sum specific rows in a data frame
I have a data frame called "pose": DESCRIPTION QUANITY CLOSING.PRICE 1 WHEAT May/10 1 467.75 2 WHEAT May/10 2 467.75 3 WHEAT May/10 1 467.75 4 WHEAT May/10 1 467.75 5 COTTON NO.2 May/10 1 78.13 6 COTTON NO.2 May/10 3 78.13 7 COTTON NO.2 May/10 1 78.13
2008 Jul 10
2
false discovery rate !
Dear All, It is not a typical R question (though I use R for this) but I thought someone will help me. For the list of P values, I have calculated FDR using p.adjust() in R (bioconductor). But my FDR values are same for all the P values. When do we get same FDR values? Does the smallest P values should less than 1/N? (where N is the number of P values) Thanks in advance. Kind regards, Ezhil
2009 Sep 11
3
Working with large matrix
Dear All, I have large matrix (46000 x 11250). I would like to do the linear regression for each row. I wrote a simple function that has lm() and used apply(mat,1,func). The issue is that it takes ages to load the file and also to finish the lm. I am using LINUX 64 bit with 32G mem. Is there an elegant and fast way of completing this task? Thanks in advance. Kind regards, Ezhil
2007 Apr 27
2
Scatter Plot in R - Help
Dear All, I am using the following commands to do the scatter plot of two vectors, say X and Y. plot(X,Y, col="blue") abline(a=1,b=1, col="red") abline(a=-1,b=1, col="green") I would like to split the scatter plot into 3 part with 3 different colors: (i) points lies between 2 lines, (ii) points above line 1, and (iii) points below line 2. I am struggling to do
2006 May 29
2
newbie question: ROW average
Dimitris Rizopoulos wrote: > look at ?rowMeans; you can also use "apply(mat, 1, mean)" but > rowMeans() is better. By my reading of the question, this is not what Ezhil wants. He said: ``I have a 992 x 74 matrix. I would like to form a new matrix by averaging each 4 rows from the original one.'' I.e. he wants (I think) the first row of the new matrix to be the
2005 Oct 26
3
Storing graphics output in PNG format.
Dear All, How can I store hist() or any plot output graphics in PNG format? I tried with bitmap() but not getting the result. Appreciate your help on fixing this. Thanks in Advance. Regrads, Ezhil
2008 Nov 21
2
Extracting diagonal matrix
Dear All, I have a correlation matrix of size 100 x 100 and would like to extract the diagonal matrix from it. I have used the for loop to store tha correlation values of the diagonal matrix. Is there a 'R way' of doing this? Thanks in advance. Kind regards, Ezhil
2008 Nov 21
2
Calculating correlation for a big matrix
Dear All, I have a matrix of size 10000 x 50. I would like to calculate all possible pair-wise correlation coefficient (5x10^7 combinations) using cor(). How can I efficiently calcualte and save the result in a matrix? Thanks in advance. Kind regards, Ezhil
2010 Feb 16
2
Error of Stepwise Regression with number of rows in use has changed: remove missing values?
Howdy, R Grues I have enjoyed R, but I cannot solve one problem easily. Please help my problem. When I tried the R script, I got the following Error. This error results from input data file exported through a Excel spreadsheet software. Error in step(lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + ?: ??number of rows in use has changed: remove missing values?