# Re: [R] Analyzing Intervals between Data

From: jim holtman <jholtman_at_gmail.com>
Date: Sat, 26 Jul 2008 21:09:12 -0400

On Sat, Jul 26, 2008 at 8:09 PM, Jia Ying Mei <jiamei_at_princeton.edu> wrote:
> Hi,
>
> The truth is, I really don't have any idea what I want to do code-wise,
> because I'm not familiar with doing this kind of stuff in R.
>
> What I need is the mean and median for the spell length of a price (i.e.
> prices change over time, but what is the mean and median of the length of
> each interval between changes?), see the attached economist pdf file for an
> idea of what data I am trying to get.
>
> So, I have these two text files that I can merge and fill in the missing
> values like so:
>
>> fmt<-"%m/%d/%y"
>> dd\$Date<-as.Date(dd\$Date, fmt)
>>library(zoo)
>>newdata<-merge(data, zoo(,dd\$Date)
>>Finaldata<-na.locf(newdata, fromLast=TRUE)
>
> I need some way after this to find the mean and median of the intervals
> themselves between each price change by country. Looking at the breakdown
> below, that seems to be mean and median of prices within certain intervals
> (not sure though), but that is not what I need.
>
> Attached is the rough code in Stata for those who know Stata and can convert
> into R, but for a different set of data that is formatted the same way. I
> feel like I've come back to square 1, but ANY help would be appreciated,
> thanks! If not clear, I can definitely clarify points.
>
> Jia Ying Mei
>
> PS. I want to do this in R because I know it will be less complicated in R
> and because I don't own Stata.

R-help_at_r-project.org 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. Received on Sun 27 Jul 2008 - 01:15:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Jul 2008 - 04:32:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.