Re: [R] mean() produces NA on double column [FIXED]

2021-11-04 Thread Rich Shepard
On Thu, 4 Nov 2021, Rui Barradas wrote: Maybe which(is.na(pdx_stage$ft)) Have you tried na.rm = TRUE? mean(pdx_stage$ft, na.rm = TRUE) Rui, I just scrolled through the data file. Yes, there are severeal NAs when the equipment was down and I hadn't put na.rm = TRUE in the read_csv() import co

Re: [R] mean() produces NA on double column

2021-11-04 Thread Rui Barradas
Hello, Maybe which(is.na(pdx_stage$ft)) Have you tried na.rm = TRUE? mean(pdx_stage$ft, na.rm = TRUE) Hope this helps, Rui Barradas Às 18:34 de 04/11/21, Rich Shepard escreveu: I'm not seeing what's different about this tibble so that mean() returns NA on a column of doubles: head(pdx

[R] mean() produces NA on double column

2021-11-04 Thread Rich Shepard
I'm not seeing what's different about this tibble so that mean() returns NA on a column of doubles: head(pdx_stage) # A tibble: 6 × 8 site_nbr year mon dayhr min tz ft 1 14211720 200710 1 1 0 PDT3.21 2 14211720 200710 1 130 PD

Re: [R] Mean absolute error from data matrix

2021-06-23 Thread PIKAL Petr
Sunday) See help page for Date weekdays(.leap.seconds) and you can do any calculation for each row See tapply, aggregate, ... Cheers Petr > -Original Message- > From: R-help On Behalf Of Faheem Jan via > R-help > Sent: Wednesday, June 23, 2021 8:03 PM > To: R-help Mailin

[R] Mean absolute error from data matrix

2021-06-23 Thread Faheem Jan via R-help
I have data matrix of order 24*2192 where 2192 are the days and 24 are hour's of a single day,so simple words I have 2192 days and each day having 24 observations.the data matrix is divided into two matrix,the ist matrix is of order 24*1827 and second is of order 24*365. Suppose the ist column o

Re: [R] Mean of a row of a data frame

2018-03-20 Thread Richard M. Heiberger
rowMeans is designed for speed. It also has as.matrix inside it. On Tue, Mar 20, 2018 at 10:40 PM, Boris Steipe wrote: > R > rowMeans(roop) > [1] 1.67 5.33 3.000000 > R > mean(as.numeric(roop[1,])) > [1] 1.67 > > > :-) > > > > >> On M

Re: [R] Mean of a row of a data frame

2018-03-20 Thread Richard M. Heiberger
> mean(list(1,4,0)) [1] NA Warning message: In mean.default(list(1, 4, 0)) : argument is not numeric or logical: returning NA > mean(unlist(roop[1,])) [1] 1.67 > apply(roop, 1, mean) [1] 1.67 5.33 3.00 data.frame is a list with some matrix characteristics. The list characteristic

Re: [R] Mean of a row of a data frame

2018-03-20 Thread Boris Steipe
R > rowMeans(roop) [1] 1.67 5.33 3.00 R > mean(as.numeric(roop[1,])) [1] 1.67 :-) > On Mar 20, 2018, at 10:18 PM, Sorkin, John wrote: > > I am trying to get the mean of a row of a data frame. My code follows: > > > roop <- data.frame(x=c(

[R] Mean of a row of a data frame

2018-03-20 Thread Sorkin, John
I am trying to get the mean of a row of a data frame. My code follows: roop <- data.frame(x=c(1,2,3),y=c(4,5,2),z=c(0,9,4)) roop mean(roop[1,]) mean(roop[1,c("x","y","z")]) I get the following output: > roop x y z 1 1 4 0 2 2 5 9 3 3 2 4 > mean(roop[1,]) [1] NA Warning message: In mean.defau

[R] Mean correlation within cluster

2017-06-13 Thread Sergio Ferreira Cardoso
Hello all, I'd like to calculate the mean correlation within a cluster and understand if it's significantly >0. I'm using packages 'geomorph' and 'paleomorph'. #Simulate an array A <- array ( rep ( 1 : 36 , by = 4 ), dim = c ( 12 , 3 , 4 )) #Load 'geomorph' package and superimpose coordinate

Re: [R] mean of a column in a list of data frames

2017-02-05 Thread Rui Barradas
Hello, Try instead the following. aList<- numeric(3) for(i in 1:3){ aList[i] <- mean(ownersList[[i]]$grossIncome) } aList Hope this helps, Rui Barradas Em 05-02-2017 12:01, Brandon Payne escreveu: I have a list of data frames, ownersList <- list(exp2004owners,exp2005owners,

Re: [R] mean of a column in a list of data frames

2017-02-05 Thread Duncan Murdoch
On 05/02/2017 7:01 AM, Brandon Payne wrote: I have a list of data frames, ownersList <- list(exp2004owners,exp2005owners, exp2006owners,exp2007owners, exp2008owners,exp2009owners, exp2010owners,exp2011owners, exp2012

[R] mean of a column in a list of data frames

2017-02-05 Thread Brandon Payne
I have a list of data frames, ownersList <- list(exp2004owners,exp2005owners, exp2006owners,exp2007owners, exp2008owners,exp2009owners, exp2010owners,exp2011owners, exp2012owners,exp2013owners, exp20

Re: [R] mean for every quartile

2016-05-16 Thread David L Carlson
ect.org] On Behalf Of ch.elahe via R-help Sent: Monday, May 16, 2016 8:46 AM To: Michael Dewey; ulrik.ster...@gmail.com Cc: R-help Mailing List Subject: Re: [R] mean for every quartile Thnaks for your reply, By using tapply I get this result: tapply(df$BR, findInterval(df$BR, quant

Re: [R] mean for every quartile

2016-05-16 Thread ch.elahe via R-help
Thnaks for your reply, By using tapply I get this result: tapply(df$BR, findInterval(df$BR, quantile(df$BR)), mean) 1 3 4 5 256 320 384 512 But I think this is not true,cause I have to get 5 means but here I get four numbers! On Monday, May 16, 2016 6:29 AM, Michael

Re: [R] mean for every quartile

2016-05-16 Thread Ulrik Stervbo
Hi Elahe, you can create a matrix of ranges and loop over each row: m <- c(384, 384, 384, 384, 512, 384, 384, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 384, 384, 384, 320, 320, 320, 320, 384, 384, 256, 320, 320, 320, 384, 320, 320, 320, 384, 384, 320, 320, 320, 320, 320, 320, 320, 320, 32

Re: [R] mean for every quartile

2016-05-16 Thread Michael Dewey
Dear Elahe In line On 16/05/2016 13:31, ch.elahe via R-help wrote: Hi all, I have a column in my df and I want to get quartiles for this column and then calculate mean for each and every quartile, here is my column: The quartiles are strictly speaking the boundaries but if you really meant

[R] mean for every quartile

2016-05-16 Thread ch.elahe via R-help
Hi all, I have a column in my df and I want to get quartiles for this column and then calculate mean for each and every quartile, here is my column: df$BR [1] 384 384 384 384 512 384 384 320 320 320 320 320 320 320 320 320 320 384 [19] 384 384 320 320 320 320 384 384 256 320 320 32

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Atte Tenkanen
Hm..., Should these two versions produce the same solution? Unfortunately and shame to confess, I don't know much about the colors in R: myColors <- c("#FF7C00","#00BF40","#00") Colors=rgb2hsv(col2rgb(myColors)) apply(Colors,1,mean) h s v 0.2122974 1.000 0.9163

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Atte Tenkanen
Thanks to William and Bert! Atte 16.4.2016, 18.56, William Dunlap kirjoitti: > Since these are color strings, you can use functions in the grDevices > package (other others) to manipulate them. E.g., you can convert them > to various color spaces and perhaps use the mean in one of those > spaces

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Duncan Murdoch
On 16/04/2016 12:33 PM, Atte Tenkanen wrote: Hm..., Should these two versions produce the same solution? I wouldn't expect them to. Duncan Murdoch Unfortunately and shame to confess, I don't know much about the colors in R: myColors <- c("#FF7C00","#00BF40","#00") Colors=rgb2hsv(col2

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread boB Rudis
grDevices has `convertColor()` and the `colorspace` has other functions that can convert from RBG to Lab space. You should convert the RGB colors to Lab and average them that way (or us other functions to convert to HSL or HSV). It all depends on what you are trying to accomplish with the "average"

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Duncan Murdoch
On 16/04/2016 8:47 AM, Atte Tenkanen wrote: Hi, How would you calculate the "mean colour" of several colours, for example c("#FF7C00","#00BF40","#00")? Bert answered your subject line question. Your text is asking something else: if those are colours, you don't want to treat each of th

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread William Dunlap via R-help
Since these are color strings, you can use functions in the grDevices package (other others) to manipulate them. E.g., you can convert them to various color spaces and perhaps use the mean in one of those spaces as your 'average color'. > myColors <- c(One="#FF7C00",Two="#00BF40",Three="#00

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Bert Gunter
... and if you need to convert back: ?as.hexmode -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, Apr 16, 2016 at 8:20 AM, Bert Gunter wrote: >

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Bert Gunter
?strtoi You'll have to remove the "#" first, e.g. via substring() -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, Apr 16, 2016 at 5:47 AM, Atte

[R] Mean of hexadecimal numbers

2016-04-16 Thread Atte Tenkanen
Hi, How would you calculate the "mean colour" of several colours, for example c("#FF7C00","#00BF40","#00")? Yours, Atte Tenkanen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] Mean effect size in meta-analysis using Metafor

2015-12-21 Thread Viechtbauer Wolfgang (STAT)
arlijn . > Sent: Monday, December 21, 2015 14:35 > To: Michael Dewey; r-help@r-project.org > Subject: Re: [R] Mean effect size in meta-analysis using Metafor > > Dear Michael, > > Thanks for your reaction. The estimates in the example in the link are > not exactly identic

Re: [R] Mean effect size in meta-analysis using Metafor

2015-12-21 Thread Carlijn .
50.093 0.506 ** DBD 0.114 0.084 1.354 0.178 -0.053 0.281 ADHD0.087 0.104 0.8360.405 -0.119 0.293 > Subject: Re: [R] Mean effect size in meta-analysis using Metafor > To: wibbelt...@hotmail.com; r-help@r-project.org > From: li

Re: [R] Mean effect size in meta-analysis using Metafor

2015-12-12 Thread Michael Dewey
Dear Carlijn I wonder whether http://www.metafor-project.org/doku.php/tips:comp_two_independent_estimates answers your question? If you had given us an example of your fitting procedure we might know for sure. On 12/12/2015 15:35, Carlijn . wrote: Hi all, I have a question about doing

Re: [R] Mean effect size in meta-analysis using Metafor

2015-12-12 Thread Bert Gunter
**If** I understand correctly, this is because of correlation in effects due to non-independence between males and females in the data. As this is primarily a statistical, not an R programming, issue, I suggest you post on a statistics list like stats.stackexchange.com. Better yet, talk with a loca

[R] Mean effect size in meta-analysis using Metafor

2015-12-12 Thread Carlijn .
Hi all, I have a question about doing a meta-analysis, in particular a three-level meta-analysis using Metafor. I have estimated the mean overall effect size of males by using two different ways: 1. moderator analysis (male = 0, female = 1) using the whole data set 2. intercept-only model

Re: [R] Mean error message missing

2015-06-08 Thread Christian Brandstätter
Thank you very much, I didn't know that. On 08/06/2015 6:04 AM, Christian Brandstätter wrote: Thank you for the explanation. But if you take for instance plot.default(), being another generic function, it would not work like that: plot(1,2,3,4), only plot(1,2) is accepted. From R-help (Usag

Re: [R] Mean error message missing

2015-06-08 Thread Duncan Murdoch
On 08/06/2015 6:04 AM, Christian Brandstätter wrote: > Thank you for the explanation. > But if you take for instance plot.default(), being another generic > function, it would not work like that: > plot(1,2,3,4), only plot(1,2) is accepted. > > > From R-help (Usage): > ## Default S3 method: > m

Re: [R] Mean error message missing

2015-06-08 Thread Christian Brandstätter
Thank you for the explanation. But if you take for instance plot.default(), being another generic function, it would not work like that: plot(1,2,3,4), only plot(1,2) is accepted. From R-help (Usage): ## Default S3 method: mean(x, trim = 0, na.rm = FALSE, ...) What is puzzling, is that apparen

Re: [R] Mean error message missing

2015-06-08 Thread Achim Zeileis
On Mon, 8 Jun 2015, Christian Brandstätter wrote: Dear list, I found an odd behavior of the mean function; it is allowed to do something that you probably shouldn't: If you calculate mean() of a sequence of numbers (without declaring them as vector), mean() then just computes mean() of the fi

[R] Mean error message missing

2015-06-08 Thread Christian Brandstätter
Dear list, I found an odd behavior of the mean function; it is allowed to do something that you probably shouldn't: If you calculate mean() of a sequence of numbers (without declaring them as vector), mean() then just computes mean() of the first element. Is there a reason why there is no warn

Re: [R] Mean rain per rain day

2015-05-13 Thread Jim Lemon
Hi Frederic, It looks like you have a number of daily rainfall values and you want to get the mean rainfall on days where there was some rain. What you probably want is: daily_rainfall<-rpois(50,2) mean(daily_rainfall[daily_rainfall>0]) You may have to add na.rm=TRUE if there are NAs in your data

[R] Mean rain per rain day

2015-05-12 Thread Frederic Ntirenganya
Hi All, I want to compute Mean rain per rain day from rainfall data but i don't know how to go about that. Anyone who understand the approach I can use can help me. In addition, I would like to have RScript which can help me to compute it. thanks. Regards, Frederic. Frederic Ntirenganya Maseno U

Re: [R] Mean of dates

2015-04-27 Thread Jue Lin-Ye
Y MM DD HH >>> 2015 04 24 01 >>> 2015 04 24 02 >>> 2015 04 24 06 >>> >>> Where >>> >>> : year >>> MM:month >>> DD:day >>> HH: hour >>> >>> How could I calculate the mean of the ISOdatetim

Re: [R] Mean of dates

2015-04-24 Thread Jue Lin-Ye
re >> >> : year >> MM:month >> DD:day >> HH: hour >> >> How could I calculate the mean of the ISOdatetime(,MM,DD,HH,0,0) of >> these? >> > > With the mean() method? On my machine: > > R> mean(ISOdatetime(,MM,DD,HH,0,0)

Re: [R] Mean of dates

2015-04-24 Thread Achim Zeileis
my machine: R> mean(ISOdatetime(,MM,DD,HH,0,0)) [1] "2015-04-24 03:00:00 CEST" hth, Z Note: I set minutes and seconds to 0, as I don't have data for them. ?Thank you in advance!? -- Jue Lin-Ye --- Civil Enginee

[R] Mean of dates

2015-04-24 Thread Jue Lin-Ye
Dear fellow R-help members, If my data is MM DD HH 2015 04 24 01 2015 04 24 02 2015 04 24 06 Where : year MM:month DD:day HH: hour How could I calculate the mean of the ISOdatetime(,MM,DD,HH,0,0) of these? Note: I set minutes and seconds to 0, as I don't have data for them. ​Tha

Re: [R] mean calculation

2015-01-26 Thread arun
Hi Juvin, The error "dim(X) must have a positive length" usually shows when you are passing a vector to "apply", ie. apply(1:5,2,mean) #Error in apply(1:5, 2, mean) : dim(X) must have a positive length Also, if your dataset originally has "1206" columns, it is not clear why you n

Re: [R] Mean of colMeans

2014-05-22 Thread arun
ment. > Please refer to www.vestas.com/legal/notice > If you have received this e-mail in error please contact the sender. > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >> On Behalf Of Sarah Goslee >

Re: [R] Mean of colMeans

2014-05-21 Thread Boris Steipe
. > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >> On Behalf Of Sarah Goslee >> Sent: 21. maj 2014 21:11 >> To: Kate Ignatius; r-help >> Subject: Re: [R] Mean of colMeans >> >&g

Re: [R] Mean of colMeans

2014-05-21 Thread Igor Sosa Mayor
Kate Ignatius writes: > Hi All, > > I've successfully gotten out the colMeans for 60 columns using: > > col <- colMeans(x, na.rm = TRUE, dims = 1) > > My next question is: is there a way of getting a mean of all the > column means (ie a mean of a mean)? maybe mean(x) ? -- :: Igor Sosa Mayor

Re: [R] Mean of colMeans

2014-05-21 Thread Frede Aakmann Tøgersen
to:r-help-boun...@r-project.org] > On Behalf Of Sarah Goslee > Sent: 21. maj 2014 21:11 > To: Kate Ignatius; r-help > Subject: Re: [R] Mean of colMeans > > That would be because col is a function in base R, and thus a poor > choice of names for user objects. Nonetheless, it wor

Re: [R] Mean of colMeans

2014-05-21 Thread Kate Ignatius
n't provide reproducible example so who knows. > > R> set.seed(1) > R> x <- data.frame(matrix(runif(150), ncol=10)) > R> # col is a function, so not a good name > R> col <- colMeans(x) > R> mean(col) > [1] 0.5119 > > It's polite to include th

Re: [R] Mean of colMeans

2014-05-21 Thread Sarah Goslee
on, so not a good name R> col <- colMeans(x) R> mean(col) [1] 0.5119 It's polite to include the list on your reply. Sarah On Wed, May 21, 2014 at 2:50 PM, Kate Ignatius wrote: > That didn't work: gave me the error = > > [1] NA > Warning message: > In mea

[R] Mean of colMeans

2014-05-21 Thread Kate Ignatius
Hi All, I've successfully gotten out the colMeans for 60 columns using: col <- colMeans(x, na.rm = TRUE, dims = 1) My next question is: is there a way of getting a mean of all the column means (ie a mean of a mean)? Thanks! __ R-help@r-project.org ma

Re: [R] Mean not working in function

2014-04-16 Thread arun
Hi, Try: set.seed(48) dat1 <- data.frame(matrix(sample(c(NA, 1:20), 4 * 20, replace = TRUE), ncol = 4), fac1 = sample(LETTERS, 20, replace = TRUE)) mysummary <- function(dataf) { indx <- sapply(dataf, is.numeric) for (name in names(dataf)[indx]) { cat("Variable name: ", name, ": Mean=", mean(da

Re: [R] mean calculations from a dframe column

2014-04-14 Thread andre.zacha...@gmail.com
hello, yes I will try colmeans, I thought it will not get rid of th NA's But thank you for the advice! Andre 2014-04-14 13:25 GMT+01:00 David McPearson [via R] < ml-node+s789695n4688731...@n4.nabble.com>: > On Sun, 13 Apr 2014 05:01:40 -0700 (PDT) "[hidden > email]

Re: [R] mean calculations from a dframe column

2014-04-14 Thread David McPearson
On Sun, 13 Apr 2014 05:01:40 -0700 (PDT) "andre.zacha...@gmail.com" wrote > Thank you very much!! > .. .. > *De :* arun kirshna [via R] > *Envoyé :* 13 avril 2014 11:23 > *À :* andre.zacha...@gmail.com > *Objet :* Re: mean calculations from a dframe column > > Hi André, > > Your codes wer

Re: [R] mean calculations from a dframe column

2014-04-13 Thread andre.zacha...@gmail.com
Thank you very much!! You saved me a lot of time now! When you look for the key for hours Many thank again André *De :* arun kirshna [via R] *Envoyé :* 13 avril 2014 11:23 *À :* andre.zacha...@gmail.com *Objet :* Re: mean calculations from a dframe column Hi André, Your codes we

Re: [R] mean calculations from a dframe column

2014-04-13 Thread arun
Hi André,  Your codes were missing in some information. If your code looks like this: Measure <- function(a, b) { a <- as.matrix(a) b <- as.matrix(b) Mean <- apply(a, 2, mean, na.rm = TRUE) somme <- c() for (i in seq_along(b)) somme[i] <- divide(Mean, b[i]) somme <- as.data.frame(somme) return(

Re: [R] Mean not working in function

2014-04-11 Thread arun
Hi, Try: mysummary <- function(dataf){ for(name in names(dataf)){ cat ("Variable name: ", name, ": Mean=", mean(dataf[,name],na.rm=TRUE),"\n") } }  ##Using some example data: set.seed(48) dat1 <- as.data.frame(matrix(sample(c(NA,1:20),4*20,replace=TRUE),ncol=4)) mysummary(dat1) #Variable name:

Re: [R] Mean of values in different files

2014-04-11 Thread arun
Hi, Try: dir.create("final") lst1 <- split(list.files(pattern=".csv"),gsub("\\_.*","",list.files(pattern=".csv"))) lst2 <- lapply(lst1,function(x1) lapply(x1, function(x2) {lines1 <- readLines(x2); header1 <- lines1[1:2]; dat1 <- read.table(text=lines1,header=FALSE,sep=",",stringsAsFactors=FAL

[R] mean fn in combination with by() XXXX

2014-04-10 Thread Dan Abner
Hi all, Can anyone please explain the following results (why does median() work here but not mean())? Is there a fix or work around for this? Thanks, Dan > by(urpdata[,2],urpdata[,12],mean,na.rm=TRUE) Error in FUN(X[[1L]], ...) : could not find function "FUN" > by(urpdata[,2],urpdata[,12],med

Re: [R] mean help?

2014-02-12 Thread Rui Barradas
Hello, At an R prompt type ?mean ?sd ?median And read the file R-intro.pdf that comes with your installation of R. Hope this helps, Rui Barradas Em 12-02-2014 18:20, frankreynolds escreveu: Hey everyone, I need help getting the mean, standard deviation, median, etc. I'm just not sure how to

Re: [R] mean help?

2014-02-12 Thread Don McKenzie
Frank — you need to read the R tutorial that came with your installation. If you don’t have the answers to your VERY BASIC questions after that, let us know. On Feb 12, 2014, at 10:20 AM, frankreynolds wrote: > Hey everyone, I need help getting the mean, standard deviation, median, etc. > I'm

[R] mean help?

2014-02-12 Thread frankreynolds
Hey everyone, I need help getting the mean, standard deviation, median, etc. I'm just not sure how to write those codes in r and if someone could also help me out with the table command that would be great too. same issue just not really sure how to write it out. thanks for your time everyone!

Re: [R] Mean: category wise within a data frame

2013-12-24 Thread arun
HI, May be this helps: Please use ?dput() to show the example dataset dat1 <- read.table(text="Categories  Variable Frequencies 1 0.009 1003 1 0.867 1200 1 0.567 987 1 0.765 134 1 0.445 890 2 0.007 899   2 0.768 707    2 0.789 865 2 0.544  678    2  0.987 889",sep="",

Re: [R] Mean: category wise within a data frame

2013-12-24 Thread David Carlson
() function: ?aggregate David Carlson -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nandini Jayakumar Sent: Tuesday, December 24, 2013 4:36 AM To: r-help@r-project.org Subject: [R] Mean: category wise within a data frame Hello all I

[R] Mean: category wise within a data frame

2013-12-24 Thread Nandini Jayakumar
Hello all I have a table a sample of which is as follows: Categories Variable (x)

Re: [R] Mean error

2013-10-29 Thread arun
Hi, Try either: res1 <- apply(mydata[,1:2],2,mean)  res2 <- colMeans(mydata[,1:2])  identical(res1,res2) #[1] TRUE # Also if you need to find means for each group ("Ungrazed vs. "Grazed") by(mydata[,-3],mydata[,3],colMeans) #or if column names are "V1", "V2", "V3" aggregate(.~V3,mydata,mean) #or

Re: [R] mean

2013-09-04 Thread S Ellison
> -Original Message- > When I try to apply mean to a list, I get the answer : > > argument is not numeric or logical: returning NA > Example: l4 <- list(1:4) class(l4) #not numeric or logical ... mean(l4) #same error #a list is not a number, a logical (TRUE/FALSE) or a vector or arra

Re: [R] mean

2013-08-30 Thread arun
a3)) #[1] 5.285714 A.K. - Original Message - From: Albyn Jones To: agnes69 Cc: r-help@r-project.org Sent: Friday, August 30, 2013 11:59 AM Subject: Re: [R] mean It would be easier to diagnose the problem if you included an example illustrating exactly what you did.  I'll guess:

[R] mean

2013-08-30 Thread agnes69
When I try to apply mean to a list, I get the answer : argument is not numeric or logical: returning NA Could you help me? (I am a very beginner) -- View this message in context: http://r.789695.n4.nabble.com/mean-tp4674999.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] mean

2013-08-30 Thread Roy Mendelssohn - NOAA Federal
Use is.numeric(list) on the list to see if it is a list of numbers or if it is list of characters. If it is a list of characters (which could be the case if you read it in using read.csv or the like) and it makes sense to convert to numeric, then do something like: list<-as.numeric(list) -R

Re: [R] mean

2013-08-30 Thread Albyn Jones
It would be easier to diagnose the problem if you included an example illustrating exactly what you did. I'll guess: > a <- list(3,4,5) > mean(a) [1] NA Warning message: In mean.default(a) : argument is not numeric or logical: returning NA > mean(as.numeric(a)) [1] 4 But that's just a guess, as

Re: [R] mean

2013-08-30 Thread arun
Hi, Better would be to show a reproducible example using ?dput() and the codes you used.  Assuming that you tried something like this: lst1<- list(1:10,c(5,4,3),4:15)  mean(lst1) #[1] NA #Warning message: #In mean.default(lst1) : argument is not numeric or logical: returning NA  sapply(lst1,mean) 

Re: [R] Mean using different group for a real r beginner

2013-05-16 Thread arun
Hi, Try either: tolerance <- read.csv("http://www.ats.ucla.edu/stat/r/examples/alda/data/tolerance1.txt";)  aggregate(exposure~male,data=tolerance,mean)  # male exposure #1    0 1.246667 #2    1 1.12 #or  library(plyr)  ddply(tolerance,.(male),summarize,exposure=mean(exposure)) #  male expos

Re: [R] mean for each observation

2013-05-03 Thread arun
HI, Not sure I understand it correctly. dat1<- read.table(text=" site Year doy fish Feed swim agr_1 agr_2 agr_3 rest hide 3 2012 203 1 1 0 0 0 0 0 0 3 2012 203 1 0 1 0 0 0 0 0 3 2012 203 1 0 1 0 0 0 0 0 3 2012 203 2 0 0 0 0 0 1 0 3 2012 203 2 1 0 0 0 0 0 0 3 2012 203 2 1 0 0 0 0 0 0 4 2012 197 1 0

Re: [R] Mean calculation by two variables

2013-01-17 Thread arun
igues To: Rui Barradas Cc: r-help@r-project.org Sent: Wednesday, January 16, 2013 11:23 PM Subject: Re: [R] Mean calculation by two variables Hello Rui! Thanks a lot for your help! Sorry for make mistake with the factor's name, was inattention during data preparation for the asking

Re: [R] Mean calculation by two variables

2013-01-16 Thread Raoni Rodrigues
Hello Rui! Thanks a lot for your help! Sorry for make mistake with the factor's name, was inattention during data preparation for the asking mail. Unfortunately, it not simple mean calculation, because same individual could have more than one row, if it eat more than a food item. In example data

Re: [R] Mean calculation by two variables

2013-01-16 Thread Rui Barradas
Hello, If you want to calculate the mean weight by Specie and Food.item, you can use ?aggregate. In what follows, I've named your EXAMPLE ex and your SOLUTION sol. Note that the result is different from sol. (No exemplo não há Peixe, é Fish, e os números são outros.) aggregate(Weight ~ Specie +

[R] Mean calculation by two variables

2013-01-16 Thread Raoni Rodrigues
Hello All, I have a data frame (dput information below) with food item weight for fish species. I need to calculate the Mean proportion by weight of each food item for each specie, as show in solution data frame (dput information below). I use the ddply function (plyr package) in two steps. Firs

Re: [R] Mean according to the combination of two factors

2013-01-11 Thread Rui Barradas
Hello, Try the following. # make up some data dat <- data.frame(values = rnorm(100), experiment = sample(10, 100, TRUE), composite = sample(17, 100, TRUE)) aggregate(values ~ experiment + composite, data = dat, FUN = mean) Hope this helps, Rui Barradas Em 11-01-2013 23:26, li li escreveu:

[R] Mean according to the combination of two factors

2013-01-11 Thread li li
Dear all, I have a data frame where there are three variables: values, experiment, composite. Values are numerical values. There are 10 levels for the experiment. Within each level of experiment, there are 17 levels of composite. I want to find mean for each combination of levels of the experi

Re: [R] mean of each month in data

2012-12-17 Thread Rui Barradas
thankyou very much indeed once again eliza Date: Mon, 17 Dec 2012 09:32:54 -0800 From: smartpink...@yahoo.com Subject: Re: [R] mean of each month in data To: eliza_bo...@hotmail.com CC: r-help@r-project.org HI, May be this helps: dat1<-read.table("Eliza.txt",sep="",header

Re: [R] mean of each month in data

2012-12-17 Thread Rui Barradas
n, 17 Dec 2012 09:32:54 -0800 From: smartpink...@yahoo.com Subject: Re: [R] mean of each month in data To: eliza_bo...@hotmail.com CC: r-help@r-project.org HI, May be this helps: dat1<-read.table("Eliza.txt",sep="",header=TRUE,stringsAsFactors=FALSE) library(reshape2) res<-lap

Re: [R] mean of each month in data

2012-12-17 Thread eliza botto
h indeed once again eliza > Date: Mon, 17 Dec 2012 09:32:54 -0800 > From: smartpink...@yahoo.com > Subject: Re: [R] mean of each month in data > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org > > HI, > > May be this helps: > dat1<-read.table("El

Re: [R] mean of each month in data

2012-12-17 Thread arun
   3 2.27  2.4 2.27  2.4 A.K. - Original Message - From: eliza botto To: "r-help@r-project.org" Cc: Sent: Monday, December 17, 2012 12:11 PM Subject: [R] mean of each month in data Dear R users, [in case the format of email is changed or you dont finf it easy to understand, i ha

Re: [R] mean of each month in data

2012-12-17 Thread David L Carlson
ject.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Rui Barradas > Sent: Monday, December 17, 2012 12:06 PM > To: eliza botto > Cc: r-help@r-project.org > Subject: Re: [R] mean of each month in data > > Hello, > > Something like this? > > > dat <

Re: [R] mean of each month in data

2012-12-17 Thread Rui Barradas
Hello, Something like this? dat <- structure(list(st = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1

[R] mean of each month in data

2012-12-17 Thread eliza botto
Dear R users, [in case the format of email is changed or you dont finf it easy to understand, i have attached a text file of my question] i have the data in the following format and i want to convert it in the format given at the end. Ta ans Sa are the names of certain cities. there are 69 citie

Re: [R] Mean-Centering Question

2012-12-09 Thread David L Carlson
t; project.org] On Behalf Of arun > Sent: Sunday, December 09, 2012 10:27 AM > To: Ray DiGiacomo, Jr. > Cc: R help > Subject: Re: [R] Mean-Centering Question > > Hi, > > You could also use: > newFunction1<-function(x) {t(t(log(x))-colMeans(log(x)))} > >  res1<-

Re: [R] Mean-Centering Question

2012-12-09 Thread arun
ements for res is data.frame and res1 is matrix.  A.K. - Original Message - From: "Ray DiGiacomo, Jr." To: R Help Cc: Sent: Saturday, December 8, 2012 11:11 PM Subject: Re: [R] Mean-Centering Question Hi David and Arun, Thanks for looking into this.  I think I have fo

Re: [R] Mean-Centering Question

2012-12-08 Thread arun
ay DiGiacomo, Jr." To: R Help Cc: Sent: Saturday, December 8, 2012 6:54 PM Subject: [R] Mean-Centering Question Hello, I'm trying to create a custom function that "mean-centers" data and can be applied across many columns. Here is an example dataset, which is simil

Re: [R] Mean-Centering Question

2012-12-08 Thread Ray DiGiacomo, Jr.
Hi David and Arun, Thanks for looking into this. I think I have found a solution. The "by" function will run ok without errors but the values returned in the second row of the "Los Angeles" output are both incorrect. These incorrect values are shown below in red. I think my original custom fun

Re: [R] Mean-Centering Question

2012-12-08 Thread David Winsemius
On Dec 8, 2012, at 7:06 PM, Elizabeth Fuller Bettini wrote: please remove me from this list. You subscribed and only you know the password that allows you to control the subscription options. Please use the links at the bottom of every posting to Rhelp. On Sat, Dec 8, 2012 at 6:54 PM,

Re: [R] Mean-Centering Question

2012-12-08 Thread David Winsemius
On Dec 8, 2012, at 3:54 PM, Ray DiGiacomo, Jr. wrote: Hello, I'm trying to create a custom function that "mean-centers" data and can be applied across many columns. Here is an example dataset, which is similar to my dataset: dat <- read.table(text="Location,TimePeriod,Units,AveragePrice

Re: [R] Mean-Centering Question

2012-12-08 Thread Elizabeth Fuller Bettini
please remove me from this list. On Sat, Dec 8, 2012 at 6:54 PM, Ray DiGiacomo, Jr. wrote: > R-help@r-project.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] Mean-Centering Question

2012-12-08 Thread Ray DiGiacomo, Jr.
Hello, I'm trying to create a custom function that "mean-centers" data and can be applied across many columns. Here is an example dataset, which is similar to my dataset: *Location,TimePeriod,Units,AveragePrice* Los Angeles,5/1/11,61,5.42 Los Angeles,5/8/11,49,4.69 Los Angeles,5/15/11,40,5.05 Ne

[R] Mean-Centering Question

2012-12-08 Thread Ray DiGiacomo, Jr.
Hello, I'm trying to create a custom function that "mean-centers" data and can be applied across many columns. Here is an example dataset, which is similar to my dataset: *Location,TimePeriod,Units,AveragePrice* Los Angeles,5/1/11,61,5.42 Los Angeles,5/8/11,49,4.69 Los Angeles,5/15/11,40,5.05 Ne

Re: [R] mean and kurtosis

2012-11-09 Thread John Kane
: powella...@gmail.com > Sent: Fri, 9 Nov 2012 14:44:44 -0500 > To: r-help@r-project.org > Subject: [R] mean and kurtosis > > Need help! > I know how to get the mean and kurtosis for a single variable but I am > reading in an excel file that has several columns representing varia

[R] mean and kurtosis

2012-11-09 Thread Adel Powell
Need help! I know how to get the mean and kurtosis for a single variable but I am reading in an excel file that has several columns representing variables. I need a way to find descriptive statistics across ALL the variables? [[alternative HTML version deleted]] __

Re: [R] Mean of matrices entries in list of lists

2012-11-09 Thread arun
un1(list1,nameCol1,5),2) #sorted alphabetically Apr #  Group.1    x #1   1 26.0 #2   2 32.53846 #3   3 26.23077 #4   4 28.69231 #5   5 27.15385 #$Aug  # Group.1    x #1   1 23.07692 #2   2 24.69231 #3   3 25.61538 #4   4 21.07692 #5   5 31.46154 A

[R] Mean of matrices entries in list of lists

2012-11-09 Thread Flummi
Hey there, I've got a list of lists with matrices: A list with 13 entries (representing years), each of them another list with 12 matrices (representing one month). In each matrix there are as many rows as there are hours in the different months and 2 columns, since two meteorological parameters a

  1   2   3   >