Labeling Time Series in R for further analysis

Discussion in 'App Development' started by hrhyrn, Aug 17, 2015.

  1. hrhyrn

    hrhyrn

    Say I have 1 year of csv values and I want to assign a an arbitrary number/symbol/word to each day of values in R, for identification and further comparison.

    Then I want to be able to search for the days that I have labeled with the different arbitrary identifiers and organize them into groups, plot, view.

    Any tips/packages that would be useful into going about this? Please ask me for any clarification
     
  2. What data structure is your "time series"? If a data frame, just add a column, or use the row names.
     
  3. hrhyrn

    hrhyrn

    Datetime, open, high, low, close
    but in order to plot it in xts, it is now Datetime, close, both series are 1 min bars.

    There are two problems I think, 1 being that date and time are combined into a single column, so putting the identifier it for one date would create many blank values.

    2 being, how to keep the ability to plot as chart_Series or another chart alternative and be able to search based on the different names.

    An example being, I want to label all the days that gap up open 20+ points. And I want to label them "fish" and then search for all the days labeled "fish" and plot them as a chart.
     
  4. spacewiz

    spacewiz

    Just add another column to mark your rows with boolean/logical data type, then on your plot you can can a separate plot "line" using points for the markers.
     
  5. hrhyrn

    hrhyrn

    Thank you, but since there are so many minute bars for each day, should I mark all of them? And then that will add so many data points, as I want to label the day, and view it minutebyminute.
     
  6. spacewiz

    spacewiz

    Either cast datetime to date, and mark rows based on "date" column (i.e. all rows for 8/17/2015 are marked together) , or you need another data.frame with data aggregated by date (no time) for labeling days.
     
  7. hrhyrn

    hrhyrn

    ok, and then how would I search for and plot those labeled dates afterwards? ideally i'd like to see all the charts of dates that fit that criteria rather than plot each one of them individually, as I'm currently doing via the chart_Series function. if I could export the group of charts into as a pdf or whatever that would be swell.
     
  8. spacewiz

    spacewiz

  9. Would be helpful to himself and those trying to help if OP posted his current code. Otherwise it's just guesswork as to what he's trying to do, and what's working or not.
     
  10. hrhyrn

    hrhyrn

    Currently don't have any additional code working aside from simple plotting via chart_Series of my current datetime and close values for 1 min data. But that is just basic.

    What I want to do is label DAYS in the data with a word/attribute/identifier, but the date and time are combined into one column as DateTime. Maybe i should just label all of the minute bars but then there are so many more results.

    Then I want to search those days and view them. Maybe export them, see the distribution of highs and lows on the days. Perhaps it would be better to split the DateTime columns into date and time in order to see the most often values better?
     
    #10     Aug 18, 2015