appear a link when users log in),
although we do realize that a few longtime and valued contributors may use its
facility when traveling.
--
David
> /Henrik
>
>>
>> John Kane
>> Kingston ON Canada
>>
>>
>>> -Original Message-
>
Hi,
It looks like you are replying to some phantom. Is your correspondent actully
on R-help?
John Kane
Kingston ON Canada
> -Original Message-
> From: mtr...@buffalo.edu
> Sent: Fri, 19 Dec 2014 08:08:29 -0800 (PST)
> To: r-help@r-project.org
> Subject: Re: [R] Calculati
nal Message-
>> From: mtr...@buffalo.edu
>> Sent: Fri, 19 Dec 2014 08:08:29 -0800 (PST)
>> To: r-help@r-project.org
>> Subject: Re: [R] Calculating mean, median, minimum, and maximum
>>
>> You can use the apply function which "applies" a functi
You can use the apply function which "applies" a function of your choice, and
MARGIN = 2 means you want to do it columnwise:
> apply(X = df, MARGIN=2, FUN = mean, na.rm = TRUE)
Latitude Longitude January February March April May
June
26.9380 -109.8125 159.8454 156.4489
Can you show what the first few rows of your table look like so that we
understand the structure?
--
View this message in context:
http://r.789695.n4.nabble.com/Calculating-mean-median-minimum-and-maximum-tp4700862p4700919.html
Sent from the R help mailing list archive at Nabble.com.
_
Hello,
Try
aggregate(latency ~ state + conditionNo + subject, data = dat, FUN = mean)
Rui Barradas
Em 03-06-2013 12:29, Laura Thomas escreveu:
Hi,
Thanks all for the help. I have used the dput function which I have posted
below. What I am trying to do is calculate the mean latency for each
Hi again Laura,
Let's say your data.frame is called df, just run this:
aggregate(latency~subject+conditionNo+state, data=df, FUN=mean)
I think this is what you're looking for.
For help, check ?aggregate and ?formula.
HTH,
Ivan
--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosci
olnames(res1)
row.names(res2)<-1:nrow(res2)
identical(res1,res2)
#[1] TRUE
A.K.
- Original Message -
From: Laura Thomas
To: Rui Barradas
Cc: r-help@r-project.org
Sent: Monday, June 3, 2013 7:29 AM
Subject: Re: [R] Calculating Mean
Hi,
Thanks all for the help. I have used the dput f
Hi,
Thanks all for the help. I have used the dput function which I have posted
below. What I am trying to do is calculate the mean latency for each
state(1-8), in each condition (1-10), for each participant (n=13). I know for
this to be most efficient I would need some form of loop, but this is
3 5:15 AM
Subject: [R] Calculating Mean
Hi All,
Sorry about this quite basic, but I am very new to R.
I have a data file which has a dependent variable (reaction time) and a couple
of independent variables, one of which is coded 1-8; I want to calculate the
reaction time for each of the 8 codes
Hello,
Like Ivan said, you should give us a data example, the best way is to do
it is to paste the output of ?dput in a post. If your data frame is
named 'dat' use the following.
dput(head(dat, 50)) # paste the output of this in a post
As for the question, here is an example using ?aggregat
Hi Laura,
I think you're looking for aggregate()
See ?aggregate
If you had posted a reproducible example, I could have given you a more
detailed answer. Learn to use the dput() function to do so.
If you're very new to R, maybe this could help you get started:
http://www.burns-stat.com/document
Hi All,
Sorry about this quite basic, but I am very new to R.
I have a data file which has a dependent variable (reaction time) and a couple
of independent variables, one of which is coded 1-8; I want to calculate the
reaction time for each of the 8 codes of the independent variable.
Thanks fo
579.4 473.2 585.1 508.3 643.7 432.1 587.2 547.6 506.2
#9 471.8 321.0 375.8 394.4 355.5 434.4 532.1 640.5 490.1 619.1
#10 356.6 434.3 403.9 445.0 416.2 532.8 570.9 548.9 697.9 488.8
A.K.
- Original Message -
From: ya
To: r-help
Cc:
Sent: Saturday, January 19, 2013 9:49 AM
Subject: [R]
p-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of ya
> Sent: Saturday, January 19, 2013 8:50 AM
> To: r-help
> Subject: [R] calculating mean matrix
>
> Hi list,
>
> Thank you vey much for reading this post.
>
> I have a data frame, I am trying
One way using `Reduce`:
set.seed(45)
grp <- factor(rep(letters[1:10], each=10)) # equivalent of your column x
# dummy data
df <- as.data.frame(matrix(sample(1:1000, replace=T),
ncol=length(levels(grp
# solution
Reduce('+', split(df, grp))/length(levels(grp))
Arun
On Saturday, January 1
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of ya
> Sent: Saturday, January 19, 2013 8:50 AM
> To: r-help
> Subj
Hi list,
Thank you vey much for reading this post.
I have a data frame, I am trying to split it into a couple of data frame using
one of the columns, say, x. After I get the data frames, I am planning to treat
them as matrices and trying to calculate an element by element mean matrix.
Could an
Sarah,
You can try this
mean(sapply(1:n.imp, function(x) complete(imp,x)$y))
Weidong Gu
On Wed, Jul 20, 2011 at 6:05 AM, Sarah wrote:
> Hi all,
>
> How can I calculate the mean from several imputed data sets with the package
> mice?
> I know you can estimate regression parameters with, for exa
Hi all,
How can I calculate the mean from several imputed data sets with the package
mice?
I know you can estimate regression parameters with, for example, lm and
subsequently pool those parameters to get a point estimate using functions
included in mice. But if I want to calculate the mean value
On Tue, Jul 19, 2011 at 5:20 PM, Dimitri Liakhovitski
wrote:
> Thanks a lot, Sarah.
> I assume, if the values against which I am comparing are REALLY zero
> ("0") - then even the first one (mean(testvec[testvec != 0])) should
> work, right?
> Dimitri
Well, yes. But what's "really" zero?
> ((.2 +
Sarah et. al:
On Tue, Jul 19, 2011 at 1:56 PM, Sarah Goslee wrote:
> In the more general case, that approach is prone to machine precision
> error (FAQ 7.31).
>
> Here's a clunky but safer alternative:
>
Perhaps ?zapsmall .
However, I would agree with your sentiments that it may depend on
conte
Thanks a lot, Sarah.
I assume, if the values against which I am comparing are REALLY zero
("0") - then even the first one (mean(testvec[testvec != 0])) should
work, right?
Dimitri
On Tue, Jul 19, 2011 at 4:56 PM, Sarah Goslee wrote:
> In the more general case, that approach is prone to machine pr
In the more general case, that approach is prone to machine precision
error (FAQ 7.31).
Here's a clunky but safer alternative:
> set.seed(1234)
> testvec <- sample(0:10, 100, replace=TRUE)
> mean(testvec)
[1] 4.31
> mean(testvec[testvec != 0])
[1] 4.842697
> mean(testvec[!sapply(testvec, function
You can do it by subsetting or indexing
r<-c(0,0,0,rnorm(10,10,5))
> mean(r)
[1] 8.052215
> mean(r[r!=0])
[1] 10.46788
Weidong Gu
On Tue, Jul 19, 2011 at 4:36 PM, Dimitri Liakhovitski
wrote:
> Sorry if it's been discussed before - don't seem to find it.
> I'd like to calculate a mean while ign
Sorry if it's been discussed before - don't seem to find it.
I'd like to calculate a mean while ignoring zeros.
"mean" doesn't seem to have an option for that.
Any other function/package that could do it?
Thanks for a pointer!
--
Dimitri Liakhovitski
marketfusionanalytics.com
__
On Wed, Dec 15, 2010 at 2:22 PM, Jim Maas wrote:
> I get a list object from an iterative function. I'm trying to figure out
> the most efficient way to calculate the mean of one element, across all
> components of the overall list.
>
> I've tried
>
> output <- mean (listobject[[1:5]]$element)
>
>
Try this:
mean(unlist(sapply(listobject[1:5], '[', 'element')))
On Wed, Dec 15, 2010 at 11:22 AM, Jim Maas wrote:
> I get a list object from an iterative function. I'm trying to figure out
> the most efficient way to calculate the mean of one element, across all
> components of the overall lis
I get a list object from an iterative function. I'm trying to figure
out the most efficient way to calculate the mean of one element, across
all components of the overall list.
I've tried
output <- mean (listobject[[1:5]]$element)
to get the mean of "element" in the first five components?
I
On 2010-09-27 15:20, Joshua Wiley wrote:
Hi,
Peter's suggestion is more general, but for just the weighted mean,
there is a built in function you can use (I do not know of any basic
weighted standard deviation or variance functions).
dat<- data.frame(age = 1:5, no = c(21, 31, 9, 12, 6))
weighte
On 09/28/2010 02:34 AM, Jonas Josefsson wrote:
I have a two-column table as follows where age is in the 1st column and
the number of individuals is in the 2nd.
age;no
1;21
2;31
3;9
4;12
5;6
Can I use mean() and sd() to calculate the mean and standard deviation
from this or do I have to manuall
Hi,
Peter's suggestion is more general, but for just the weighted mean,
there is a built in function you can use (I do not know of any basic
weighted standard deviation or variance functions).
dat <- data.frame(age = 1:5, no = c(21, 31, 9, 12, 6))
weighted.mean(x = dat$age, w = dat$no)
Best rega
On Mon, Sep 27, 2010 at 9:34 AM, Jonas Josefsson
wrote:
> I have a two-column table as follows where age is in the 1st column and the
> number of individuals is in the 2nd.
>
> age;no
> 1;21
> 2;31
> 3;9
> 4;12
> 5;6
You can use the following trick:
x = rep(age, no)
This repeats age[1] no[1]-ti
I have a two-column table as follows where age is in the 1st column and
the number of individuals is in the 2nd.
age;no
1;21
2;31
3;9
4;12
5;6
Can I use mean() and sd() to calculate the mean and standard deviation
from this or do I have to manually multiplicate 21*1+31*2 etc. / N?
_
On Feb 10, 2010, at 1:18 PM, Steve Murray wrote:
Dear all,
I am attempting to perform what should be a relatively simple
calculation on a number of data frame columns. I am hoping to find
the average on a per-row basis for each of the 50 columns. If on a
particular row a 'NA' value is e
Dear all,
I am attempting to perform what should be a relatively simple calculation on a
number of data frame columns. I am hoping to find the average on a per-row
basis for each of the 50 columns. If on a particular row a 'NA' value is
encountered, then this should be ignored and the mean for
:
>> Thanks for the reply Stephen,
>> but the samples it makes are all the same:
>> " f <- do.call(rbind , rep(A1[sample(nrow(A1), 5),], 5)) " if U print out
>> "f", you'll see they are all the same.
>>
>> --- On Mon, 10/20/08, stephen s
are all the same.
>
> --- On Mon, 10/20/08, stephen sefick <[EMAIL PROTECTED]> wrote:
>
> From: stephen sefick <[EMAIL PROTECTED]>
> Subject: Re: [R] calculating mean for samples
> To: [EMAIL PROTECTED], "R Help"
> Date: Monday, October 20, 2008, 12:05 PM
&g
and calculate
> the grand mean
>
>
>
> --- On Mon, 10/20/08, stephen sefick <[EMAIL PROTECTED]> wrote:
>
> From: stephen sefick <[EMAIL PROTECTED]>
> Subject: Re: [R] calculating mean for samples
> To: "Alex99" <[EMAIL PROTECTED]>
> Dat
Hi everyone,
> does any one knows how can I calculate mean for different samples
> i.e. I have a data like this:
>
> s1 s2 s3 s4
> 1 0 0 0 1
> 2 1 0 1 0
> 3 0 0 0 0
> 4 0 0 0 0
> 5 0 1 0 1
> 6 1 0 0 0
> 7 0 0 0 0
> 8 0 0 0 0
> 9 0 0 0 0
> 10 0 0 0
40 matches
Mail list logo