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
I compare this value to another time of the day to see if the price was
reached/broken.  For example the 2:00 to 2:30 low from above is 11 at 2:30.
I would then check the 8:00 to 13:00 time period to see if the 2:00 to 2:30
low occured from 8:00 to 13:00.  If it did occur I would call this day a
qualifier and check the time 2:30 price occured in the 8:00 to 13:00 period
until the price at 13:00.  So another example if 2:30 was 11, 8:00 was 13,
8:45 was 11, and 13:00 was 20 I would say this day qualified and the price
from the am was first acheived at 8:45 in the 8:00 to 13:00 period and the
change from that price to the 13:00 period was 20-11=+9.

This example was all background to my problem.  Using the filx/readlines
methods I wind up with output for the days which qualify, but when I try to
create an array variable using the total of each line for a given column
(aka summarizing every day that my given criteria were met), something about
having used the line by line method doesn't allow me to create an array
variable.  It only gives me the last value.  The variables I declared to
fidn the qualifying days are specific to each day vs across all days that
qualified.  Is it possible to convert this line by line data into an array
wih some R code I don't know?

I considered converting the data example above into a matrix, but then I run
into tricky problems of shortened days and days missing data (the code I
used for the readlines method enables me to specify the new days without
this problem...I don't have to fill in blanks it just changes days when it
hits a new day).  Given how specific this problem is I can't find much on
the R help logs.

Perhaps outputting the line by line output to a file, then reinputting it
using a read.csv method would enable me to achieve my desired result but
then I have the laborious task of dumping into excel, converting file types,
saving as csv, reuploading to R, writing a separate program, etc.

Is there an easy fix to my problem?

Thanks

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to