Re: [R] aggregation of irregular interval time-series

2021-06-13 Thread Enrico Gabrielli
Hello thanks to my friend Diego, a computer agronomist, I was able to figure out how to do it. I still have only one problem: how do I calculate the data for the first week? The traps were set up on the fields on May 5th. On that date, a 0 could be entered for all time-series. But how to do it with

Re: [R] aggregation of irregular interval time-series

2021-06-10 Thread Enrico Gabrielli
sorry, i'm a bit of a bummer at copying and saving various pieces of code and I'm not very experienced with R - I am trying to build a partnership with a local IT cooperative, but this is a job that was not foreseen and it is not covered by budget, so I am trying to solve it myself - I do not want

Re: [R] aggregation of irregular interval time-series

2021-06-09 Thread Bert Gunter
I have *not* followed this in any detail, but this line seems wrong: arvaia_catture_order <- arvaia_catture[order(arvaia_catture$tempo)] Perhaps it should be: arvaia_catture_order <- arvaia_catture[order(arvaia_catture$tempo), ] ## note the comma! If I am mistaken, just ignore and move on. Chee

Re: [R] aggregation of irregular interval time-series

2021-06-09 Thread Rui Barradas
Hello, I'm not getting your simple sum: arvaia_catture_order[, week := as.integer(format(tempo, "%U"))] aggregate(catture ~ week, arvaia_catture_order, sum) # week catture #1 19 15 #2 20 5 #3 21 78 #4 22 120 Can you explain your result better? Hope this helps, R

[R] aggregation of irregular interval time-series

2021-06-09 Thread Enrico Gabrielli
Hello I just registered on the list. I am an agricultural technician and I am collaborating on a research project on agroforestry and Brown Marmorated Stink Bug (Halyomorpha halys, abbreviated BMSB). Through kobotoolbox we are collecting data of catches in traps on farms. Farms register inconsiste

Re: [R] Aggregation across two variables in data.table

2017-12-14 Thread PIKAL Petr
ay, December 14, 2017 8:48 AM > To: r-help@r-project.org > Cc: Michael Haenlein > Subject: [R] Aggregation across two variables in data.table > > Dear all, > > I have a data.frame that includes a series of demographic variables for a > set of respondents plus a dependent va

[R] Aggregation across two variables in data.table

2017-12-13 Thread Michael Haenlein
Dear all, I have a data.frame that includes a series of demographic variables for a set of respondents plus a dependent variable (Theta). For example: AgeEducation Marital Familysize IncomeHousingTheta 1: 50 Ass

Re: [R] Aggregation

2014-02-18 Thread arun
Hi, May be this helps: DataA <- read.table(text="ID,Var1,Var2 1,A,100 1,B,50 2,A,200 2,B,100 2,B,50",sep=",",header=TRUE,stringsAsFactors=FALSE) dcast(DataA,ID~Var1,value.var="Var2")  ## I guess this is what you mentioned #Aggregation function missing: defaulting to length #  ID A B #1  1 1 1 #2 

Re: [R] Aggregation

2014-02-13 Thread farnoosh sheikhi
Thanks:)   Regards, Farnoosh Sheikhi On Thursday, February 13, 2014 1:29 PM, arun wrote: Sorry, the library should be library(reshape2) On Thursday, February 13, 2014 4:27 PM, arun wrote: HI Farnoosh, You can use ?dcast() library(plyr)  dcast(DataA,ID~Var1,value.var="Var2") #  ID  

Re: [R] Aggregation

2014-02-13 Thread arun
Sorry, the library should be library(reshape2) On Thursday, February 13, 2014 4:27 PM, arun wrote: HI Farnoosh, You can use ?dcast() library(plyr)  dcast(DataA,ID~Var1,value.var="Var2") #  ID   A   B #1  1 100  50 #2  2 200 100 A.K. On Thursday, February 13, 2014 2:59 PM, farnoosh she

Re: [R] Aggregation

2014-02-13 Thread arun
HI Farnoosh, You can use ?dcast() library(plyr)  dcast(DataA,ID~Var1,value.var="Var2") #  ID   A   B #1  1 100  50 #2  2 200 100 A.K. On Thursday, February 13, 2014 2:59 PM, farnoosh sheikhi wrote: Hi Arun, I hope all is well. I need to aggregate a data like below: DataA ID       Var1  

Re: [R] aggregation-type question

2013-02-08 Thread Rui Barradas
Hello, With the following, the first instruction will give you correlations matrices, the second coefficients. dat <- read.table(text = " x y group 1 0.876751503 0.6518345 a 2 0.627067150 0.8801790 a 3 0.632465192 0.1768305 a 4 0.060359554 0.8835652 a 5 0.67586

Re: [R] aggregation-type question

2013-02-08 Thread John Kane
d.cars...@kcl.ac.uk > Sent: Fri, 8 Feb 2013 08:33:45 -0800 (PST) > To: r-help@r-project.org > Subject: [R] aggregation-type question > > I seem to have a Friday afternoon block and can't see the easiest way of > doing this. > > Given a data frame like: > > dat &l

[R] aggregation-type question

2013-02-08 Thread carslaw
I seem to have a Friday afternoon block and can't see the easiest way of doing this. Given a data frame like: dat <- data.frame(x = runif(100), y = runif(100), group = rep(letters[1:10], each = 10)) > head(dat) x y group 1 0.876751503 0.6518345 a 2 0.627067150 0.8801790

Re: [R] aggregation question

2011-07-08 Thread Jim Lemon
Dr Eberhard Lisse wrote: > Hi, > > I am reading payment data like so > > 2010-01-01,100.00 > 2010-01-04,100.00 > ... > 2011-01-01,200.00 > 2011-01-07,100.00 > > and plot it aggregated per month like so > > library(zoo) > df <- read.csv("daily.csv", colClasses=c(d="Date",s="numeric")) > z <- zoo(d

Re: [R] aggregation question

2011-07-07 Thread Gabor Grothendieck
On Thu, Jul 7, 2011 at 5:41 AM, Dr Eberhard Lisse wrote: > Hi, > > I am reading payment data like so > > 2010-01-01,100.00 > 2010-01-04,100.00 > ... > 2011-01-01,200.00 > 2011-01-07,100.00 > > and plot it aggregated per month like so > > library(zoo) > df <- read.csv("daily.csv", colClasses=c(d="D

[R] aggregation question

2011-07-07 Thread Dr Eberhard Lisse
Hi, I am reading payment data like so 2010-01-01,100.00 2010-01-04,100.00 ... 2011-01-01,200.00 2011-01-07,100.00 and plot it aggregated per month like so library(zoo) df <- read.csv("daily.csv", colClasses=c(d="Date",s="numeric")) z <- zoo(df$s, df$d) z.mo <- aggregate(z, as.yearmon, sum) barp

[R] aggregation question

2011-07-06 Thread Dr Eberhard Lisse
Hi, I am reading payment data like so 2010-01-01,100.00 2010-01-04,100.00 ... 2011-01-01,200.00 2011-01-07,100.00 and plot it aggregated per month like so library(zoo) df <- read.csv("daily.csv", colClasses=c(d="Date",s="numeric")) z <- zoo(df$s, df$d) z.mo <- aggregate(z, as.yearmon, sum) barp

[R] Aggregation and the meaning of class

2008-05-30 Thread Chip Barnaby
Dear R-ers, My aggregation saga continues. Using the following sequence, I can calculate any statistic for row groups and merge the result back to all associated rows ... > WM = by( D60, D60[ "KeyProfA"], FUN=function(x) weighted.mean( x$IAC, x$Wt)) > D60$IAC.WM = as.numeric( WM[ D60$KeyProf

Re: [R] aggregation with two statistical functions - mean and variance

2007-12-25 Thread Gabor Grothendieck
On Dec 25, 2007 4:41 AM, Pfeiffer & Koberstein Immobilien GmbH - Ralf Pfeiffer <[EMAIL PROTECTED]> wrote: > thank you, I downloaded and installed the package. With library(help="doBy") > I got the information about this package. > > But when I use the syntax > > summaryBy(daten[,c(3:4)], list(A,B)

Re: [R] aggregation with two statistical functions - mean and variance

2007-12-25 Thread Pfeiffer & Koberstein Immobilien GmbH - Ralf Pfeiffer
ryBy) I tried before require(doBy), but this doesn't work neither. What can I do? - Original Message - From: "Gabor Grothendieck" <[EMAIL PROTECTED]> To: "Agrarimmobilien" <[EMAIL PROTECTED]> Cc: Sent: Monday, December 24, 2007 10:48 PM Subject: Re:

Re: [R] aggregation with two statistical functions - mean and variance

2007-12-24 Thread Gabor Grothendieck
See summaryBy in the doBy package. On Dec 24, 2007 4:27 PM, Agrarimmobilien <[EMAIL PROTECTED]> wrote: > Hello, > > using the syntax > > aggregate(daten[,c(3,4)], list(A,B), mean) > > I'm getting the following data.frame: > > >A BCD > 1 351 6.16000

[R] aggregation with two statistical functions - mean and variance

2007-12-24 Thread Agrarimmobilien
Hello, using the syntax aggregate(daten[,c(3,4)], list(A,B), mean) I'm getting the following data.frame: A BCD 1 351 6.16000 5 2 47131.24333 20 3 54126.81773 2 4 3 212.990