[R] simple time series plot

David Winsemius dwinsemius at comcast.net
Tue Apr 17 21:59:06 CEST 2012


On Apr 17, 2012, at 2:04 PM, phibo wrote:

> I'm an absolute R newbie, but my question is (or at least seems)  
> simple:
>
> I have a number of sensor values from different sensors, along with
> timestamps, so something like this:
>
> sensor 1:
> read_at:    1     2     4     5     6
> value:        1   15     8    15  23
>
> sensor 2:
> read_at:    2    3     4     6     7
> value:       10  11    7    12  28
>
> what I need is a line plot of the sensor values, aligned given their
> timestamps (it's in unix epoc time).

Probably something simple can be done to convert to POSIXct.

>
> which data structure should i use? can i import from CSV file?

Of course you can. Generally works well. Other separators work as well.

> how should I
> format that data file?

Can you show us what the file look like by just pasting a few rows  
into a message"


>
> which commands do I need to get the plot? is there a simple tutorial  
> (didn't
> find any).

There is the "Introduction to R" shipped with every installation of R,  
which is about as "simple" as it gets. Most people seem to skip that  
step, but it is packed with crucial concepts and illustrations.

>
> how would you solve this?

First we need to see how the data looks to a plain text editor.
>
-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list