[R] Converting a line by line program into an array to perform summary stats

Dieter Menne dieter.menne at menne-biomed.de
Wed Sep 29 20:29:32 CEST 2010



George Coyle wrote:
> 
> I am trying to turn several lines of information into a variable.  I used
> the filx function to input my file then the readlines to qualify what I
> want.  Essentially I have data in a file every 10 minutes through a day
> for
> several years down a column:
> 
> date time value
> 9/28/10   02:00  13
> 9/28/10   02:10  15
> 9/28/10   02:20  12
> 9/28/10   02:30  11
> etc.
> 
> I then use if statements to segment the day into various portions (2:00 to
> 2:30 for example) and find the average or maximum value for the time. 
> Next
> .....
> 

George,

it is very difficult to understand what you want, so let' try to chop it
down. Let's say you want to find the best way to do some time of processing
on what generally called a time series.

First, reading this into a matrix will not work, because you have three
different column types. The standard workhorse for this type of data is a
dataframe, and read.csv gives a data frame.

Next, note that your structure is even simpler: you have a time series,
probably not an regular one, because I assume your stock quotes are not
available all the time with equal intervals, but will stop at night.

So the general idea would be: 
>> read in a data frame with read.csv
>> convert to a time series. See package zoo for many examples
>> do the processing (which I do not understand) on the time series

Dieter


-- 
View this message in context: http://r.789695.n4.nabble.com/Converting-a-line-by-line-program-into-an-array-to-perform-summary-stats-tp2719489p2719542.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list