Re: [R] Oh apply functions, how you confuse me

2011-09-01 Thread ROLL Josh F
Subject: Re: [R] Oh apply functions, how you confuse me Is this close to what you are asking for: > require(data.table) > Dt.. <- data.table(Df..) > R <- Dt..[, + list( + sum = sum(Volume) + , weight = sum(Volume * Mph) / sum(Volume) + ) + , by = list

Re: [R] Oh apply functions, how you confuse me

2011-09-01 Thread jim holtman
Is this close to what you are asking for: > require(data.table) > Dt.. <- data.table(Df..) > R <- Dt..[, + list( + sum = sum(Volume) + , weight = sum(Volume * Mph) / sum(Volume) + ) + , by = list(Min5Break, Day, Hour, Dir) + ] > R Min5Break Day Hour Dir

Re: [R] Oh apply functions, how you confuse me

2011-09-01 Thread Patrick Burns
I would suggest using a 'for' loop rather than an apply function. The advantage is that you will probably understand the loop that you write, and it will run in roughly the same amount of time as a complicated call to an apply function that you don't understand. On 01/09/2011 18:11, LCOG1 wrote:

[R] Oh apply functions, how you confuse me

2011-09-01 Thread LCOG1
Hi guys, I have a crap load of data to parse and have enjoyed creating a script that takes this data and creates a number of useful graphics for our area. I am unable to figure out one summary though and its all cause I dont fully understand the apply family of functions. Consider the following: