Re: [R] means by year, month and day

2016-07-18 Thread Tom Mosca
, 2016 12:14 PM To: Tom Mosca Cc: jim holtman; Jianling Fan; r-help@r-project.org Subject: Re: [R] means by year, month and day If you are very inexperienced with R you still have time to forget you ever heard of the attach function. Your code > attach(datATMP) > datATMP1 <- datA

Re: [R] means by year, month and day

2016-07-18 Thread William Dunlap via R-help
p working on it. > > > > Thank you for your kind response and examples. I will study them. > > > > Sincerely, Tom > > > > > > > From: jim holtman [jholt...@gmail.com] > Sent: Sunday, July 17, 2016 7:14 PM > To: Jianling

Re: [R] means by year, month and day

2016-07-18 Thread Tom Mosca
do want to develop better form. So, I'll keep working on it. Thank you for your kind response and examples. I will study them. Sincerely, Tom From: jim holtman [jholt...@gmail.com] Sent: Sunday, July 17, 2016 7:14 PM To: Jianling Fan Cc: Tom Mosca;

Re: [R] means by year, month and day

2016-07-17 Thread jim holtman
Here is an example of using dplyr. Please provide a reasonable subset of data. Your was all for the same date. Use 'dput' to put in your email. > x <- read.table(text = " X.YY MM DD hh WDI R.WSP D.GST PRES ATMP DEWP + 2015 1 1 0 328 3.6 4.5 1028.0 3.8 -3.5 + 2015 1 1 1 3

Re: [R] means by year, month and day

2016-07-17 Thread Jianling Fan
Hello Tom, try aggregate() or cast(). Both works.I prefer the latter. library(reshape) desc<-melt(mydata, measure.vars=c("WDI","R.WSP", "D.GST", "PRES", "ATMP", "DEWP"), id.vars=c("X.YY","MM","DD")) summary<-cast(desc, X.YY+MM+DD~variable, mean) On 17 July 2016 at 06:22, Tom

[R] means by year, month and day

2016-07-17 Thread Tom Mosca
Hello Good Folk, My dataframe looks like this: > mydata X.YY MM DD hh WDI R.WSP D.GST PRES ATMP DEWP 12015 1 1 0 328 3.6 4.5 1028.0 3.8 -3.5 22015 1 1 1 300 2.1 2.7 1027.9 3.7 -4.4 32015 1 1 2 264 2.4 2.9 1027.7 3.6 -4.5 42015 1 1 3 230 4

Re: [R] means in tables

2013-04-10 Thread arun
ginal Message - From: Silvano Cesar da Costa To: arun Cc: Sent: Wednesday, April 10, 2013 10:34 PM Subject: Re: [R] means in tables Arun, this code work very well: setwd('c:/Dados/') list.files(pattern=".txt") lst2 = lapply(list.files(pattern=".txt"), function

Re: [R] means in tables

2013-04-10 Thread arun
HI Silvano, No problem. Just wanted to make sure that it worked. Regards, A.K. - Original Message - From: Silvano Cesar da Costa To: arun Cc: Sent: Wednesday, April 10, 2013 10:34 PM Subject: Re: [R] means in tables Arun, this code work very well: setwd('c:/Dados/')

Re: [R] means in tables

2013-04-10 Thread arun
0.012   0.373 dim(res) #[1] 8000    3 A.K. - Original Message - From: Silvano Cesar da Costa To: arun Cc: Sent: Wednesday, April 10, 2013 9:38 PM Subject: Re: [R] means in tables I performed all the procedures you described. I read each file with the command: lst2[[1]]; lst2[[2]]

Re: [R] means in tables

2013-04-10 Thread arun
.K. - Original Message - From: arun To: Silvano Cesar da Costa Cc: R help Sent: Wednesday, April 10, 2013 6:28 PM Subject: Re: [R] means in tables Hi,  YOu can load all the datasets directly from the directory in a list. set.seed(25)  lst1<-lapply(1:100,function(i) as.data.fra

Re: [R] means in tables

2013-04-10 Thread arun
.72  mean(unlist(lapply(lst1,function(x) x[5,2]))) #[1] 20.97 A.K. - Original Message - From: Silvano Cesar da Costa To: arun Cc: Sent: Wednesday, April 10, 2013 6:02 PM Subject: Re: [R] means in tables Hi Arun, I thought with an example with two tables I could generalize to the 100 tab

Re: [R] means in tables

2013-04-10 Thread arun
roject.org Cc: Sent: Wednesday, April 10, 2013 12:07 PM Subject: [R] means in tables Hi. I have 2 tables, with same dimensions (8000 x 5). Something like: tab1: V1  V2  V3  V4  V5 14.23 1.71 2.43 15.6 127 13.20 1.78 2.14 11.2 100 13.16 2.36 2.67 18.6 101 14.37 1.95 2.50 16.8 113 13.24 2.59 2.87

Re: [R] means in tables

2013-04-10 Thread Marc Schwartz
On Apr 10, 2013, at 11:07 AM, Silvano Cesar da Costa wrote: > Hi. > > I have 2 tables, with same dimensions (8000 x 5). Something like: > > tab1: > > V1 V2 V3 V4 V5 > 14.23 1.71 2.43 15.6 127 > 13.20 1.78 2.14 11.2 100 > 13.16 2.36 2.67 18.6 101 > 14.37 1.95 2.50 16.8 113 > 13.24 2.59 2

[R] means in tables

2013-04-10 Thread Silvano Cesar da Costa
Hi. I have 2 tables, with same dimensions (8000 x 5). Something like: tab1: V1 V2 V3 V4 V5 14.23 1.71 2.43 15.6 127 13.20 1.78 2.14 11.2 100 13.16 2.36 2.67 18.6 101 14.37 1.95 2.50 16.8 113 13.24 2.59 2.87 21.0 118 tab2: V1 V2 V3 V4 V5 1.23 1.1 2.3 1.6 17 1.20 1.8 2.4 1.2 10 1.1

Re: [R] means by group

2012-05-03 Thread Petr Savicky
On Thu, May 03, 2012 at 09:07:39PM -0400, li li wrote: > Hi all, >I have a 100 by 100 matrix and I divided this matrix into 100 groups, > each is a > 10 by 10 submatrix. I want find out the means of each group. >I know we can use apply function for mean by margins. Is there a > function i

[R] means by group

2012-05-03 Thread li li
Hi all, I have a 100 by 100 matrix and I divided this matrix into 100 groups, each is a 10 by 10 submatrix. I want find out the means of each group. I know we can use apply function for mean by margins. Is there a function in R for means by groups also? Thanks. Hannah [[alter

[R] means across list of data frames

2011-09-20 Thread Matthew Finkbeiner
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 fo

Re: [R] means and error bars on xyplot for binary data

2011-06-28 Thread Peter Ehlers
On 2011-06-28 00:12, Louis Plough wrote: Hi, I have binary (0,1) data for a trait as my response variable, and a dependent variable, genotype, with three classes (AA, AB, BB). I would like to plot this data so that across the three genoytpes, even though the points are all either 0 or 1, i want

[R] means and error bars on xyplot for binary data

2011-06-28 Thread Louis Plough
Hi, I have binary (0,1) data for a trait as my response variable, and a dependent variable, genotype, with three classes (AA, AB, BB). I would like to plot this data so that across the three genoytpes, even though the points are all either 0 or 1, i want them to stack up or be seen using 'jitter'.

Re: [R] means, SD's and tapply

2011-02-25 Thread zem
Hi Christopher, i think you have the same problem like me today :) see this http://r.789695.n4.nabble.com/group-by-in-data-frame-tc3324240.html post i think you can find there the solution zem -- View this message in context: http://r.789695.n4.nabble.com/means-SD-s-and-tapply-tp3325158p33

Re: [R] means, SD's and tapply

2011-02-25 Thread Scott Chamberlain
chris, it seems like you need the plyr package, esp ddply. for example: stems353 <- data.frame(Time = rep(c("Modern", "Old"), 4), SizeClass = rep(c("class1","class2"), each = 4), Species = rep(c("a","b"), each = 4), Stems = seq(1,8,1)) ddply(stems353, .(Species, SizeClass, Time), summarise, mea

Re: [R] means, SD's and tapply

2011-02-25 Thread Dennis Murphy
Hi: On Fri, Feb 25, 2011 at 12:09 PM, Christopher R. Dolanc < crdol...@ucdavis.edu> wrote: > I'm trying to use tapply to output means and SD or SE for my data but > seem to be limited by how many times I can subset it. Here's a snippet > of my data > > > stems353[1:10,] > Time DataSource

Re: [R] means, SD's and tapply

2011-02-25 Thread David Winsemius
On Feb 25, 2011, at 3:09 PM, Christopher R. Dolanc wrote: I'm trying to use tapply to output means and SD or SE for my data but seem to be limited by how many times I can subset it. Here's a snippet of my data stems353[1:10,] Time DataSource Plot Elevation Aspect Slope Type Sp

[R] means, SD's and tapply

2011-02-25 Thread Christopher R. Dolanc
I'm trying to use tapply to output means and SD or SE for my data but seem to be limited by how many times I can subset it. Here's a snippet of my data > stems353[1:10,] Time DataSource Plot Elevation Aspect Slope Type Species SizeClass Stems 1 ModernCameron 70F221 1730

Re: [R] Means

2011-02-18 Thread Ted Harding
On 18-Feb-11 20:51:40, Dmitry Berman wrote: > Listers, > > Is there a command/function to get the population standard deviation > (N) and > the sample standard deviation (n-1) > > Thanks Using data (1:10), with N=10, as an example: c(SampSD=1, PopSD=sqrt(9/10))*sd((1:10)) # SampSDPopS

[R] Means

2011-02-18 Thread Dmitry Berman
Listers, Is there a command/function to get the population standard deviation (N) and the sample standard deviation (n-1) Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] Means from selected columns in a data frame

2010-07-20 Thread David Winsemius
On Jul 20, 2010, at 9:25 AM, David Winsemius wrote: On Jul 20, 2010, at 9:13 AM, Marcus Drescher wrote: Hi all, I have a dataframe with survey data. Now I want to calculate means from several but not all columns (e.g. a1, a2, a3) and save them in a new separate column (e.g. a). Well t

Re: [R] Means from selected columns in a data frame

2010-07-20 Thread David Winsemius
On Jul 20, 2010, at 9:13 AM, Marcus Drescher wrote: Hi all, I have a dataframe with survey data. Now I want to calculate means from several but not all columns (e.g. a1, a2, a3) and save them in a new separate column (e.g. a). Well that would be possible unless you are in Minitab or Exce

[R] Means from selected columns in a data frame

2010-07-20 Thread Marcus Drescher
Hi all, I have a dataframe with survey data. Now I want to calculate means from several but not all columns (e.g. a1, a2, a3) and save them in a new separate column (e.g. a). Like: a = mean(a1, a2, a3) Can someone help me or give me the right key word to look for? Thanks [[alternativ

Re: [R] Means do not tally

2010-05-24 Thread Ruijie
Yes thank you very much! I knew i had different data points for each subject per condition but didn't realise that it would affect the averages of the averages! Thank you for helping me solve this big headache of mine for the past 2 days =) Regards, Ruijie (RJ) He who has a why can endu

Re: [R] Means do not tally

2010-05-24 Thread Ruijie
Thanks for your help jim. I have attached the raw data to see if anyone else can replicate my problem. Regards, Ruijie (RJ) He who has a why can endure any how. ~ Friedrich Nietzsche On 25 May 2010 00:17, jim holtman wrote: > Are you sure that you have the same number of data points

Re: [R] Means do not tally

2010-05-24 Thread jim holtman
Notice that only column 19 in your original had the same for the average of the average and every entry had 32 data points. On Mon, May 24, 2010 at 1:47 PM, jim holtman wrote: > A quick check of you data shows that there are not the same number of > sample in each of the different conditions, the

Re: [R] Means do not tally

2010-05-24 Thread jim holtman
A quick check of you data shows that there are not the same number of sample in each of the different conditions, therefore trying to take the average of the averages will not work. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 32 31 29 30 24 23 31 32 32 31 24 2

Re: [R] Means do not tally

2010-05-24 Thread Ruijie
Thanks for your help jim. I have attached the raw data to see if anyone else can replicate my problem. Correction: i realise my attachment was too large, I have uploaded it to another site. The link is: http://dl.dropbox.com/u/1443460/List%20-%20Raw%20Data.csv Regards, Ruijie (RJ) He w

Re: [R] Means do not tally

2010-05-24 Thread jim holtman
Are you sure that you have the same number of data points in each of the summary cells that you show in your csv file that was sent? You need to provide a reproducible example of all the data so we can see what you did. The best information I can provide at this point is that you have a "bug" in

Re: [R] Means do not tally

2010-05-24 Thread Ruijie
Noted. I have attached a list of some data in csv format. The first column is the SubID and the rest of the column are the mean of each condition for the particular subject. Average 1 is the average computed from each column in the list. Average 2 is computed from the raw data of all the data po

Re: [R] Means do not tally

2010-05-24 Thread Ben Bolker
Ruijie gmail.com> writes: > In my experiment, I expose 10 subjects to 24 different conditions of > stimuli. Each condition is exposed to the same subject 3x. > This would make each subject have 24x3=72 data points. All the subjects > combined would have 72x10=720 data points with each condition h

[R] Means do not tally

2010-05-24 Thread Ruijie
Hi all, here is my situation In my experiment, I expose 10 subjects to 24 different conditions of stimuli. Each condition is exposed to the same subject 3x. This would make each subject have 24x3=72 data points. All the subjects combined would have 72x10=720 data points with each condition having

Re: [R] means of a column within groups of a data frame

2008-12-11 Thread Jim Lemon
John Sorkin wrote: R 2.8.0 windows XP I would like to divide the rows of data frame into five groups and then get the mean of one column within the five groups. I have accomplished this using the code below, but I hope there is an easier way, i.e. some function that I can call # create five

Re: [R] means of a column within groups of a data frame

2008-12-10 Thread Daniel Malter
discussurus - -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von John Sorkin Gesendet: Wednesday, December 10, 2008 11:09 PM An: r-help@r-project.org Betreff: [R] means of a column within groups of a data frame R 2.8.0 windows XP

[R] means of a column within groups of a data frame

2008-12-10 Thread John Sorkin
R 2.8.0 windows XP I would like to divide the rows of data frame into five groups and then get the mean of one column within the five groups. I have accomplished this using the code below, but I hope there is an easier way, i.e. some function that I can call # create five groups. cut(data$BMI,

Re: [R] Upgrading R means I lose my packages

2008-08-29 Thread bartjoosen
est per causas scire" > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, sel

Re: [R] Upgrading R means I lose my packages

2008-08-29 Thread Leon Yee
In my situation under windows xp, after I setting the environment variable R_LIBS, neither Rgui.exe nor Rterm.exe under cmd.exe doesn't know the existence of R_LIBS. After I enter the R interface, I find .libPaths() can add a new location for installed packages: > .libPaths("d:/progra~1/R/R

Re: [R] Upgrading R means I lose my packages

2008-08-28 Thread Robert A LaBudde
At 04:12 AM 8/28/2008, ONKELINX, Thierry wrote: On a windows machine you get the same problem. Useless one uses tha same trick as Rolf suggested: don't install the packages in the default directory and set R_LIBS to that directory. Then all you need to do after an upgrade is to set R_LIBS in the

Re: [R] Upgrading R means I lose my packages

2008-08-28 Thread Don MacQueen
Speaking for myself, I think it's easier to just create a script and put it somewhere easy to remember. For example my.pkgs <- c('pkg1', 'pkg2') ## and so on for my preferred packages install.packages(my.pkgs, dependencies=TRUE) Then after each upgrade just source the script. You will nee

Re: [R] Upgrading R means I lose my packages

2008-08-28 Thread Prof Brian Ripley
On Thu, 28 Aug 2008, Michael Friendly wrote: James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to download and install each of them anew ever

Re: [R] Upgrading R means I lose my packages

2008-08-28 Thread Michael Friendly
James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to download and install each of them anew every time I install a new version of R is rather o

Re: [R] Upgrading R means I lose my packages

2008-08-28 Thread ONKELINX, Thierry
On a windows machine you get the same problem. Useless one uses tha same trick as Rolf suggested: don't install the packages in the default directory and set R_LIBS to that directory. Then all you need to do after an upgrade is to set R_LIBS in the new version and run update.package(checkBuilt = T

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Phil Spector
Could this be related to the administrative rights of the user? If a user had administrative rights, packages would be installed into the /Library/Frameworks directory, and then updating (to, I think a new major version) would remove them. Without the administrative rights it would install the

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Rolf Turner
On 28/08/2008, at 3:00 PM, Charilaos Skiadas wrote: On Aug 27, 2008, at 10:40 PM, Rolf Turner wrote: On 28/08/2008, at 2:02 PM, James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Charilaos Skiadas
On Aug 27, 2008, at 10:40 PM, Rolf Turner wrote: On 28/08/2008, at 2:02 PM, James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to downloa

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Rolf Turner
On 28/08/2008, at 2:02 PM, James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to download and install each of them anew every time I instal

[R] Upgrading R means I lose my packages

2008-08-27 Thread James Milks
The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to download and install each of them anew every time I install a new version of R is rather of a pain. Idea

Re: [R] means and variances of several groups in the matrix

2008-04-24 Thread Julian Burgos
Hy Katie, There are many ways to do this. A simple one is to create a vector of the same length than your 'x' vector, containing a group label. > group=rep(c(1,2,3),times=nr[1,]) Then you can use tapply to apply a function (in this case mean and variance) of the values of x within each group

Re: [R] means and variances of several groups in the matrix

2008-04-21 Thread Jim Lemon
kathie wrote: > Dear R users, > > I have 32 observations in data x. After sorting this, I want to compute > means and variances of 3 groups divided by "nr". > > Actually, the number of groups is flexible. Any suggestion will be greatly > appreciated. > Hi Kathryn, One way (there are many oth

[R] means and variances of several groups in the matrix

2008-04-21 Thread kathie
Dear R users, I have 32 observations in data x. After sorting this, I want to compute means and variances of 3 groups divided by "nr". Actually, the number of groups is flexible. Any suggestion will be greatly appreciated. Kathryn Lord --