Re: [R] data from graph [SEC=UNCLASSIFIED]

2007-06-12 Thread Augusto.Sanabria
Jam,

If you use fpot the GPD of package evd to calculate your 
return periods, you can generate the table you want by
using the following commands:

RP - c(10,100,500,1000)   #return periods
rf - your clean vector of rainfall data
thres - the threshold for your data
nopy - number of observations per year
rainf - c()

For(i in 1:length(RP) ){
   q = fpot(rf,thres,mper=RP[i],npp=nopy,std.err=FALSE)
   rainf[i] - q$estimate[1]
}
#The next line prints the return periods:
plot(RP,rainf,log=x,type=l,ylab=rainfall,xlab=Return Period (yrs) )

#The next line prints the table you want:
cbind(RP,rainf)

Hope it helps,

Augusto



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk  Impact Analysis Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2601
Ph. (02) 6249-9155
 
 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of umarporn charusombat
Sent: Wednesday, 13 June 2007 8:35
To: r-help@stat.math.ethz.ch
Subject: [R] data from graph


hi
i just learn how to use R in my research
i used extreame value package to get the return level of rainfall. the output
i got as the graph plot between return level and period. i wonder how i can
get the value from the graph as a table format. please help me thanks jam

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Extracting a subset from a dataframe

2007-02-22 Thread Augusto.Sanabria
Good day everyone,

Can anyone suggest an effective method to solve
the following problem:

I have 2 dataframes D1 and D2 as follows:

D1:
dates   ws   wc pwc
 2005-10-19:12:00  10.8  80  81
 2005-10-20:12:00  12.3   5  15
 2005-10-21:15:00  12.3   3  15
 2005-10-22:15:00  11.3  13  95
 2005-10-23:12:00  12.3  13   2
 2005-10-24:15:00  10.3   2  95
 2005-10-25:15:00  10.3   2   2

D2:
dates   ws   wc  pwc
 2005-02-02:15:00  17.5   5  96
 2005-02-19:15:00  20.1  15  97
 2005-02-20:18:00  16.5  95  95
 2005-03-03:18:00  10.3  95  95
 2005-03-04:00:00  13.4  13  95
 2005-10-22:15:00  11.3  13  95
 2005-10-25:15:00  10.3   2   2

I want to create another dataframe made up
of the values of dataframe1 which are not common
with dataframe2, ie. newD = D1 - (D1 intersection D2)

that is,
newD: 
   datesws   wc  pwc
 2005-10-19:12:00  10.8  80  81
 2005-10-20:12:00  12.3   5  15
 2005-10-21:15:00  12.3   3  15
 2005-10-23:12:00  12.3  13   2
 2005-10-24:15:00  10.3   2  95
 
Thanks for any help you can provide,

Augusto


Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2601
Ph. (02) 6249-9155

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Software for kriging

2007-01-03 Thread Augusto.Sanabria

Dear R-list members,

I wish everyone a happy and successful 2007!

Does anyone know of R-based software for
optimal spatial prediction (kriging)?

We are working on a seismic event characterisation
technique and need to do some kriging.

Any help would be greatly appreciated.

Augusto




Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2601
Ph. (02) 6249-9155

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ML fit of gamma distribution to grouped data

2006-11-29 Thread Augusto.Sanabria
Thomas,

The Gamma distr. can be fitted via ML using:

Library(MASS)
GF - fitdistr(given_data,gamma)
sh - GF$estimate[1]
ra - GF$estimate[2]

Fitting via Moments, m:
var - m[2] - m[1]*m[1]
sh - m[1]*m[1]/var
sc - m[1]/var
ra - 1/sc

G_pdf - dgamma(breaks,shape=sh,rate=ra,scale=1/ra)


Hope it helps,

Augusto



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2601
Ph. (02) 6249-9155
 
 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thomas Petzoldt
Sent: Tuesday, 28 November 2006 10:26
To: r-help@stat.math.ethz.ch
Subject: [R] ML fit of gamma distribution to grouped data


Hello,

we have a set of biological cell-size data, which are only available as 
frequencies of discrete size classes, because of the high effort of 
manual microscopic measurements.

The lengths are approximately gamma distributed, however the shape of 
the distribution is relatively variable between different samples (maybe 
it's a mixture in reality).

Is there any ML fitting (or moment-based) procedure for the gamma 
distribution and grouped data already available in R?

Here is a small example:

breaks - c(0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150)
mids   - c(10, 25, 35, 45, 55, 65, 75, 85, 95, 125)
counts - c(87, 5, 2, 2, 1, 1, 0, 0, 1, 1)

Any help is highly appreciated

Thomas P.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Empirical CDF

2006-06-29 Thread Augusto.Sanabria

Good day everyone,

I want to assess the error when fitting a Gram-Charlier
CDF to some data 'ws', that is, I want to calculate:

 Err = |ecdf(ws) - GCh_ser(ws)|

The problem is, I cannot get the F(x) values from the
ecdf.

'Summary(ecdf())' returns some of the x-axis values,
but how do you get the F(x) values?

Thank you for any help you can provide.

Regards,

Augusto



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Off topic --- help in locating a source.

2006-05-18 Thread Augusto.Sanabria
Rolf,

The formula can be found in section 1.44-1.45
'Trigonometric (Fourier) series' of the famous book:

Gradshteyn I.S and Ryzhik I.M. Tables of Integrals,
Series, and Products. Academic Press Inc. 4th printing.
London 1983.

Which is a translation of the Russian book from 1963.

Hope it helps,

Augusto



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155
 
 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner
Sent: Thursday, 18 May 2006 5:27 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Off topic --- help in locating a source.


Apologies for the off-topic question; as usual I'm trying to draw upon the
unparalleled knowledge and sagacity of the r-help list. Please reply off-list
if you can help me out.

A collaborator of mine found a formula we need, on sheets which he had
photocopied out of a book, some years ago.  He cannot remember which book
(he's getting to be as senile and forgetful as I am, poor bloke!).  He thinks
it was (and it appears to have been) a large encylopedic tome devoted to
extensive tables of formulae, integrals and series, and stuff like that.

The formula in question is

 oo   1  1 1
SUM  --- cos(k*x) = --- ln ()   0  x  2*pi  .
k=1   k  2   2*(1 - cos(x))

(I.e. the right hand side is a function whose Fourier coefficients are 1/k, k
 0).

Note that ``oo'' is my attempt to render the infinity symbol in ASCII.

Does anyone know of a source where this formula may found/cited? (It doesn't
*have* to be the same source from which my collaborator originally copied
it!)  It must be well-known/in lots of books,
mustn't it?   Said he, hopefully.

Thanks for any assistance.

cheers,

Rolf Turner
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to evaluate logistic model fit the data or not?

2006-05-03 Thread Augusto.Sanabria

Youme,

The question has been asked before, you can have a look
at the R archives for that issue using:

RSiteSearch(logistic goodness of fit).

Last time I did this, the command found some 53 entries!

Hope it helps,

Augusto


Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155
 
 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Yuezhou(Jerry) Jing
Sent: Thursday, 4 May 2006 1:18 AM
To: r-help@stat.math.ethz.ch
Subject: [R] how to evaluate logistic model fit the data or not?


Dear list,

I am new here. often times, I have a question about how to evaluate 
logistic model fit the data or not, do you guys can help me with some 
guidence? thanks.

Youme

-- 
Yuezhou Jing
Center for Human Growth  Development University of Michigan
___  ___   300 N. Ingalls, Rm 1064 NE   
[   \/   ]
Ann Arbor, MI 48109-0406 |   \  /   |
Office: (734) 615-4673   | |\ \/ /| |
FAX: (734) 936-9288  | | \  / | |
e-mail:[EMAIL PROTECTED]  [___] \/ [___]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] head function

2006-04-02 Thread Augusto.Sanabria

The functions 'page()', 'head()' and 'tail()'
let you look at a dataframe or array without
actually opening the file. They are equivalent
to 'less', 'more' and 'tail' in UNIX.


Hope it helps,

Augusto

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of stat stat
Sent: Monday, 3 April 2006 2:37 PM
To: r-help@stat.math.ethz.ch
Subject: [R] head function


hi all
 
can anyone tell me what is head() function in r. what
is it's utility?


thanks in advance

-


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] [Q] How to make a multi-line title with expression()

2006-03-28 Thread Augusto.Sanabria

Young-Jin,

The expression

tit1 - Max. Daily Wind Speed \nSydney Airport

hist(ws,xlab='Wind Speed',ylab='Freq.,main=tit1)

works fine in my case. Try using your title between
one set of quotes. 

Hope it helps,

Augusto


Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155
 
 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sundar Dorai-Raj
Sent: Wednesday, 29 March 2006 9:29 AM
To: Young-Jin Lee
Cc: r-help
Subject: Re: [R] [Q] How to make a multi-line title with expression()




Young-Jin Lee wrote:
 Dear R-lister
 
 Could anyone know how to make a multi-line title for a plot with 
 expression()? In my plot, the title should be writeen in two lines 
 (because it is two long for one line) and it should use a mathematical 
 expression. I tried to use \n, but \n is ignored in expression() 
 call: hist(diffChangeRequestHintsBeforeAnswering[,4], br = 50, xlab = 
 Skill Change in Standard Deviation, main = expression(paste((a) 
 HS, F[A], \nRequest hint(s)/subtask(s) before first attempt)))
 
 Thanks in advance.
 
 Young-Jin Lee
 

Try RSiteSearch(multi-line expression).

Thanks,

--sundar

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] newbie question: grouping rows

2006-03-09 Thread Augusto.Sanabria
Matt,

Have a look at subset specially the examples
at the end.

I use it a lot.

Hope it helps,

Augusto



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155
 
 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matthew Scholz
Sent: Friday, 10 March 2006 9:18 AM
To: r-help@stat.math.ethz.ch
Subject: [R] newbie question: grouping rows


Hi all,

I have a very simple question that I can't seem to find the answer to. How do
I extract rows that meet a certain criteria  from a data frame and group them
into a new data frame? For example, if I want to make a new data frame that
only includes rows of data for which the p values (given by one of the
columns in the data frame) are less than a certain value, how do I do this?
It seems that there should be a simple function that does this. I looked into
getGroups from the nmle package, but am not sure how to construct the form
argument correctly or even if it's the appropriate way to tackle this.

Thanks in advance of your answer,

Matt

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Date and Times a la Dalgaard

2006-03-09 Thread Augusto.Sanabria

To manipulate date/time I use packages zoo and
survival.

Hope it helps,

Augusto


Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155
 
 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Farrel Buchinsky
Sent: Friday, 10 March 2006 2:39 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Date and Times a la Dalgaard


Does anyone know of a resource for learning the basics of how to manage and
manipulate dates and times in R? I have been reading Introductory Statistics
with R by Peter Dalgaard which is fantastic. But alas, I could find no
reference to date and time. I have looked at the reference manual but it is
particularly unapproachable. So rather than dense technical talk I would
rather see a dataset, several arguments and commentary of what is happening.
The alternative to is to make Excel or Microsoft Access handle all the date
and time work (I have had about 16 years experience with how to calculate and
handle date and time in those programs) and then use RODBC to read it.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How do I tell it which directory to use?

2006-02-21 Thread Augusto.Sanabria

Tom,

You can define your working directory by using:

setwd(C:\Documents and Settings\Tom\My Documents\qpaper7\R Project Started 
19 Dec 05)

check that your file is there:
list.files()

and then use:

source(myFile.txt) 

the machine should load myFile

You can go to another directory:
setwd(anotherdir)

and repeat the procedure.

Or even better if you define a number of directories in an external file:

dir1 - c(C:\Documents and Settings\Tom\My Documents\qpaper7\)
dir2 - c(C:\Documents and Settings\Tom\My Documents\)

and after loading the file at the beginning of the sesion you can use:

setwd(dir1)  etc.

Is it of any help to you?

Cheers,

Augusto



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thomas L Jones
Sent: Wednesday, 22 February 2006 4:31 PM
To: R-project help
Subject: [R] How do I tell it which directory to use?


From Tom:

In R 2.2.0 under Windows, I want to be able to give it a filename such 
as myFile.txt without the quotes. But actually I mean:

C:\Documents and Settings\Tom\My Documents\qpaper7\R Project Started 
19 Dec 05\myFile.txt

If I were to repeat this each time, my computer would get all bored 
and cranky and start to drop bits (only a joke, of course). I think I 
want to set the Home directory or the working directory or some 
directory or other to the above directory. I may or may not want to 
set some environmental variables.

R 2.2.0; working directly from the console and copying and pasting 
code which I want to test into the console. Windows XP Home Edition. 
Administrator privileges are enabled. A curve ball: There are two 
accounts, Tom and Jones; the data are stored under Tom, whereas 
the computation is being done under the Jones account. I won't bore 
you with the details of why I am doing this.

I was able to call Sys.getenv (R_USER) and get the home directory.

I am a newbie to R and not familiar with the terminology.

Tom
Thomas L. Jones, Ph.D., Computer Science

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Gram-Charlier series

2006-02-21 Thread Augusto.Sanabria

 Good day everyone,

 I want to use the Gram-Charlier series expansion to model
 some data. To do that, I need functions to:

 1) Calculate 'n' moments from given data
 2) Transform 'n' moments to 'n' central moments, or
 3) Transform 'n' moments to 'n' cumulants
 4) Calculate a number of Hermite polynomials

 Are there R-functions to do any of the above?
 (mean, sd and cum3 are very limited)

 Thank you for your help,

 Augusto


Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] 15-min mean values

2006-02-07 Thread Augusto.Sanabria

Thanks a lot to Gabor for his help with the solution
of this problem. 

The solution using zoo(aggregate)
is easy to implement  efficient. I have calculated 
the 15min mean values of a 1min wind speed file 
containing 2.9 million records x 16 columns 
(size 179 MB) in just 144 seconds 
(R-2.1.1 running in a GNU/LINUX machine). 

Thanks to Bogdan too for his suggested solution using
SQL, I have not tried that one yet.

Augusto

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] 15-min mean values

2006-02-01 Thread Augusto.Sanabria

Good day everyone,

I want to use zoo(aggregate) to calculate
15-min mean values from a wind dataset which
has 1-min values. The data I have looks like this:

 vector VDATE   vector WS
1   1998-10-22:02:11  12.5
2   1998-10-22:02:12  10.1
3   1998-10-22:02:13  11.2
4   1998-10-22:02:14  10.5
5   1998-10-22:02:15  11.5
  .
  .
  .
n   2005-06-30:23:59   9.1


I want to use:

aggregate(zoo(WS),'in 15-min intervals',mean)

How do you specify 'in 15-min intervals' using
vector VDATE? The length of VDATE cannot be 
changed, otherwise it would be a trivial problem
because I can generate a 15-min spaced vector
using 'seq'.

Am I missing something?

Thanks a lot,

Augusto



Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Calculation of daily max

2006-01-17 Thread Augusto.Sanabria
Thank you Gabor, the 'aggregate' function
operating on zoo(WS) does the job beautifully!

'zoo' has a lot of other goodies too, great 
package (thanks for that too).

Cheers,

Augusto


Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155
 
 


-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 17 January 2006 4:32 PM
To: Sanabria Augusto
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Calculation of daily max


Assuming VDATE is a character vector this produces
a zoo time series object.

library(zoo)
z - aggregate(zoo(WS), as.Date(VDATE), max)

coredata(z) and time(z) are the data vector of maximums and corresponding
times, respectively.

The R command:

   vignette(zoo)

gives an introduction to zoo.

Aside from zoo you could check out ?tapply, ?by and ?aggregate .



On 1/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Good day everyone.

 I have a large dataset of 1 min wind speeds
 covering 5 years.

 How can I make an array of maximum daily values?

 The vectors I have are: 'VDATE' with dates in format '%Y-%m-%d' (like 
 '1992-10-28') and 'WS' with wind speed data (same number of elements 
 as VDATE).

 I want an array with 2 columns: Max daily wind speed and corresponding 
 day.

 Has anyone got an elegant way of doing that?
 (My background is in C++ I would tend to use loops
 but that is not very elegant in R, isn't it?)

 Augusto

 __
 R-help@stat.math.ethz.ch mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Calculation of daily max

2006-01-16 Thread Augusto.Sanabria

Good day everyone.

I have a large dataset of 1 min wind speeds
covering 5 years.

How can I make an array of maximum daily values?

The vectors I have are: 'VDATE' with dates in format
'%Y-%m-%d' (like '1992-10-28') and 'WS' with wind speed data 
(same number of elements as VDATE).

I want an array with 2 columns: Max daily wind speed and
corresponding day.

Has anyone got an elegant way of doing that?
(My background is in C++ I would tend to use loops
but that is not very elegant in R, isn't it?)

Augusto




Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html