[R] How to import timestamps from emails into R

Gabor Grothendieck ggrothendieck at gmail.com
Sat Jun 20 17:58:01 CEST 2009


If that is the situation then plot(tt) in your post could not have been
what you wanted in any case, e.g. plot(10:20)

On Sat, Jun 20, 2009 at 11:49 AM, Thomas Levine<thomas.levine at gmail.com> wrote:
> This produces the x-axis is the index, and the y-axis is time. It has all of
> the time information on the same axis, allowing me to plot cumulative
> occurrences by time (my original plan) if the times are sorted, which they
> should be.
>
> I think I'll end up using some variant of plot(tt,seq_along(tt)), putting
> the time axis along the bottom.
>
> Thanks
>
> Tom
>
> On Sat, Jun 20, 2009 at 11:15 AM, Gabor Grothendieck
> <ggrothendieck at gmail.com> wrote:
>>
>> Try this:
>>
>> plot(seq_along(tt), tt)
>>
>>
>> On Sat, Jun 20, 2009 at 10:55 AM, Thomas Levine<thomas.levine at gmail.com>
>> wrote:
>> > Here's what I get
>> >> head(tt)
>> > [1] "2008-02-20 03:09:51 EST" "2008-02-20 12:12:57 EST"
>> > [3] "2008-03-05 09:11:28 EST" "2008-03-05 17:59:40 EST"
>> > [5] "2008-03-09 09:00:09 EDT" "2008-03-29 15:57:16 EDT"
>> >
>> > But I can't figure out how to plot this now. plot(tt) does not appear to
>> > be
>> > univariate. I get the same plot with plot(as.Date(tt)), which would make
>> > sense if time is used because of the range of the dates and the
>> > insignificance of the times of day.
>> >> head(as.Date(tt))
>> > [1] "2008-02-20" "2008-02-20" "2008-03-05" "2008-03-05" "2008-03-09"
>> > [6] "2008-03-29"
>> >
>> > plot(tt) and plot(as.Date(tt)) give something like year as a function of
>> > the
>> > rest of the date. Here they are
>> >
>> >
>> > Here are the addresses
>> > http://thomaslevine.org/time/tt.png
>> > http://thomaslevine.org/time/as.Date.tt.png
>> >
>> > Tom
>> >
>> > On Fri, Jun 19, 2009 at 6:21 PM, Gabor Grothendieck
>> > <ggrothendieck at gmail.com> wrote:
>> >>
>> >> Try this:
>> >>
>> >>
>> >> Lines <- "Sun, 14 Jun 2009 07:33:00 -0700
>> >> Sun, 14 Jun 2009 08:35:10 -0700
>> >> Sun, 14 Jun 2009 21:26:34 -0700
>> >> Mon, 15 Jun 2009 19:47:47 -0700
>> >> Wed, 17 Jun 2009 21:50:41 -0700"
>> >>
>> >> # L <- readLines("myfile.txt")
>> >> L <- readLines(textConnection(Lines))
>> >> tt <- as.POSIXct(L, format = "%a, %d %b %Y %H:%M:%S")
>> >>
>> >>
>> >>
>> >> On Fri, Jun 19, 2009 at 6:06 PM, Thomas Levine<thomas.levine at gmail.com>
>> >> wrote:
>> >> > I am analysing occurrences of a phenomenon by time, and each of these
>> >> > timestamps taken from email headers represents one occurrence. (The
>> >> > last
>> >> > number is the time zone.) I can easily change the format.
>> >> >
>> >> > Sun, 14 Jun 2009 07:33:00 -0700
>> >> > Sun, 14 Jun 2009 08:35:10 -0700
>> >> > Sun, 14 Jun 2009 21:26:34 -0700
>> >> > Mon, 15 Jun 2009 19:47:47 -0700
>> >> > Wed, 17 Jun 2009 21:50:41 -0700
>> >> >
>> >> > I've found documentation for a plethora of ways of importing time
>> >> > data,
>> >> > but
>> >> > I can't decide how to approach it. Any ideas on what may be the
>> >> > cleanest
>> >> > way? The only special concern is that I'll want to plot these data by
>> >> > date
>> >> > and time, meaning that I would rather not bin all of the occurrences
>> >> > from
>> >> > one day.
>> >> >
>> >> > The time zone isn't important as these are all local times; the time
>> >> > zone
>> >> > only changes as a function of daylight savings time, so I probably
>> >> > shouldn't
>> >> > use it at all.
>> >> >
>> >> > Tom
>> >> >
>> >> >        [[alternative HTML version deleted]]
>> >> >
>> >> > ______________________________________________
>> >> > 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.
>> >> >
>> >
>> >
>
>




More information about the R-help mailing list