Hi:
Another way to do this is to use one of the summarization packages.
The following uses the plyr package.
The first step is to create a function that takes a data frame as
input and outputs either a data frame or a scalar. In this case, the
function returns a scalar, but if you want to carry a
ean
`·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º>
Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
223 East Steinfest Road
Antigo, WI 54409 USA
From:
"Michael Karol"
To:
Date:
08/02/2011 09:35 AM
Subject:
[R] Help with aggre
Dear R-experts:
I am using a function called AUC whose arguments are data, time, id, and
dv.
data is the name of the dataframe,
time is the independent variable column name,
id is the subject id and
dv is the dependent variable.
The function computes area under the curve by trapezoidal
Sam -
Since the error message said the argument wasn't numeric
or logical, that would be the source of your problem. What
is the result of
class(all$Value)
If it's 'character' or 'factor', that would explain the problem.
Provide more details for a (most likely) easy solution.
> * Jan van der Laan [2011-02-15 10:09:44 +0100]:
>
> The fact that your column names from your aggregate result contain
> multiple numbers, suggests that something has gone wrong with reading
> your data in from file. Have you had a look at your data.frame 'all'?
yes, the data is loaded correctl
> * Sam Steingold [2011-02-14 18:42:40 -0500]:
>
> byFOO$Mean <- aggregate(all$Value, by = list(all$FOO), FUN = mean)$x;
this fails with
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In mean.default(X[[1L]], ...) :
argument is not numeric
On 2011-02-14 15:42, Sam Steingold wrote:
Hi,
I am trying to aggregate some data and I am confused by the results.
I load a data frame "all" from a csv file, and then I do:
(FOO,BAR,X,Y come from the header line in the csv file,
BTW, how do I rename a column?)
byFOO<- aggregate(list(all$BAR,all
The fact that your column names from your aggregate result contain multiple
numbers, suggests that something has gone wrong with reading your data in from
file. Have you had a look at your data.frame 'all'? Are BAR and X etc. numeric?
Judging from the 'c. etc' they aren't.
So, how do I aggr
Hi,
I am trying to aggregate some data and I am confused by the results.
I load a data frame "all" from a csv file, and then I do:
(FOO,BAR,X,Y come from the header line in the csv file,
BTW, how do I rename a column?)
byFOO <- aggregate(list(all$BAR,all$QUUX,all$X/all$Y),
by
On Wed, Mar 10, 2010 at 12:08:52AM -0800, hvollmeier wrote:
>
> James,
>
> you may post your question to the R-SIG finance group with a small example.
> If I understand your problem correctly it's like converting tick data of
> financial time series into aggregates. (to 1-minute, hourly, daily
On Wed, Mar 10, 2010 at 07:48:45PM +, hadley wickham wrote:
> > Run that function hourly with plyr
> >
> > output.hourly <- dlply(df.i1,"tshour",cor.dat)
>
> Why not
>
> output.hourly <- ddply(df.i1,"tshour",cor.dat)
Doh! Because I didn't read the docs properly and missed it.
Thanks, much n
> Run that function hourly with plyr
>
> output.hourly <- dlply(df.i1,"tshour",cor.dat)
Why not
output.hourly <- ddply(df.i1,"tshour",cor.dat)
? Generally you want to work with data frames in R, if at all possible.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of St
James,
you may post your question to the R-SIG finance group with a small example.
If I understand your problem correctly it's like converting tick data of
financial time series into aggregates. (to 1-minute, hourly, daily ... data
sets ). There are packages available for this kind of task that
Hi Ista,
Many thanks, the plyr package was just what I needed.
Because I did such a bad job with my question (no data, etc etc), here
is my current solution:
First, I grabbed my data from PostgreSQL as follows:
library('RPostgreSQL')
m <- dbDriver("PostgreSQL")
con <-
dbConnect(m,user="user",pa
The sqldf package can be used to manipulate R data frames with SQL
statements. See http://sqldf.googlecode.com
On Tue, Mar 9, 2010 at 9:36 PM, James Marca wrote:
> Hello,
>
> I do not understand the correct way to approach the following problem
> in R.
>
> I have observations of pairs of variabl
Hi James,
It would really help if you gave us a sample of the data you are
working with. The following is not tested, because I don't have your
data and am too lazy to construct a similar example dataset for you,
but it might get you started.
You can try using a for loop along the lines of
output
Hello,
I do not understand the correct way to approach the following problem
in R.
I have observations of pairs of variables, v1, o1, v2, o2, etc,
observed every 30 seconds. What I would like to do is compute the
correlation matrix, but not for all my data, just for, say 5 minutes
or 1 hour chun
17 matches
Mail list logo