TimeDateSubsets          package:fCalendar          R Documentation

_t_i_m_e_D_a_t_e _C_l_a_s_s, _S_u_b_s_e_t_t_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     A collection and description of functions and methods for
     subsetting 'timeDate' objects. 

     Functions for testing 'timeDate' objects:

       'isWeekday'  Tests if a date is a weekday or not,
       'isWeekend'  Tests if a date falls on a weekend or not,
       'isBizday'   Tests if a date is a business day or not,
       'isHoliday'  Tests if a date is a non-business day or not.

     Functions for getting additional information on 'timeDate'
     objects:

       'getDayOfWeek'  Returns the day of the week to a 'timeDate' object,
       'getDayOfYear'  Returns the day of the year to a 'timeDate' object.

     Functions to extract subsets from 'timeDate' objects:

       '[.timeDate'       Extracts or replaces subsets from 'timeDate' objects,
       'window.timeDate'  Extracts a piece from a 'timeDate' object,
       'cut.timeDate'     A synonyme for the window function,
       'start.timeDate'   Extracts the first entry of a 'timeDate' object,
       'end.timeDate'     Extracts the last entry of a 'timeDate' object,
       'length.timeDate'  Gets the length of a 'timeDate' object,
       'blockStart'       Creates start dates for equally sized blocks,
       'blockEnd'         Creates end dates for equally sized blocks.

_U_s_a_g_e:

     isWeekday(x)
     isWeekend(x)
     isBizday(x, holidays = holidayNYSE())
     isHoliday(x, holidays = holidayNYSE())

     getDayOfWeek(x)
     getDayOfYear(x)

     ## S3 method for class 'timeDate':
     length(x)

     ## S3 method for class 'timeDate':
     x[..., drop = TRUE]
     ## S3 method for class 'timeDate':
     window(x, start , end, ...)
     ## S3 method for class 'timeDate':
     cut(x, from , to, ...)
     ## S3 method for class 'timeDate':
     start(x, ...)
     ## S3 method for class 'timeDate':
     end(x, ...)

     blockStart(x, block = 20)
     blockEnd(x, block = 20)

_A_r_g_u_m_e_n_t_s:

   block: an integer value specifying the length in number of records
          for numerically sized blocks of dates. 

    drop: ["["] - 
           a logical flag, by default 'TRUE'. 

from, to: [cut] - 
           starting date, required, and end date, ptional. If supplied 
          'to' must be after 'from'. 

holidays: [isBizday] - 
           holiday dates from a holiday calendar. An object of class
          'timeDate'. 

  method: [modify] - 
           a character string defining the modification method, one of
          '"sort"', '"round"', or '"trunc"'.  

start, end: [window] - 
           starting date, required, and end date, ptional. If supplied 
          'to' must be after 'from'. 

       x: [isWeekday][isWeekend][isBizday][weekDay] - 
           an object of class 'timeDate'. 
           [format][print] - 
           an object of class 'timeDate'. 

     ...: arguments passed to other methods. 

_V_a_l_u_e:

     'isWeekday'
      'isWeekend' 
      the functions return logical vectors indicating if a date is a 
     weekday, or a weekend day. 

     'isBizday'
      'isHoliday' 
      the functions return logical vectors indicating if a date is a 
     business day, or a holiday. Note, that for business and holidays 
     extraction an holiday/business calendar has to be specified.  

     'getDayOfWeek'
      'getDayOfYear' 
      the function 'getDayOfWeek' returns a three letter character 
     string with the names of the day of the week, and the function 
     'getDayOfYear' returns the day count as integer value starting
     January, 1st.  

     '[.timeDate'
      'cut.timeDate'
      'start.timeDate'
      'end.timeDate'
      'blockStart'
      'blockEnd' 
      these are functions for subsetting '"timeDate"' objects. The
     function '[.timeDate' extracts or replaces subsets, the function
     'cut' extracts a piece, the functions 'start' and 'end' extract
     the first and last  element, the functions 'blockStart' and
     'blockEnd' create vectors of  start and end values for equally
     sized blocks. All functions return an object of class
     '"timeDate"'.

_A_u_t_h_o_r(_s):

     Diethelm Wuertz for the Rmetrics R-port.

_S_e_e _A_l_s_o:

     'timeDateCoercion', 'timeDateCoercion',  'timeDateMathOps',
     'timeDateSpecDates'

     We also recommend to inspect the help pages for the POSIX time and
     date  class, '?Dates', and the help pages from the contributed R
     packages 'chron' and 'date'.

_E_x_a_m_p_l_e_s:

       
     ## Dates in April, currentYear: 
        tS = timeSequence(
           from = paste(currentYear, "-04-01", sep = ""),
           to = paste(currentYear, "-04-30", sep = ""))
        tS
         
     ## Subset of Weekends:
        isWeekend(tS)
        tS[isWeekend(tS)]
        
     ## Subset Wednesdays:
        getDayOfWeek(tS)
        tS[getDayOfWeek(tS) == "Wed"]
        
     ## Subset Business Days at NYSE:
        holidayNYSE()
        isBizday(tS, holidayNYSE())
        tS[isBizday(tS, holidayNYSE())]
          
     ## [ - Subsetting First Five Days:
        tS[1:5]   
        
     ## window - 
        GoodFriday(currentYear)
        EasterMonday(currentYear)
        window(tS, 
           start = GoodFriday(currentYear), 
           end = EasterMonday(currentYear))
        
     ## [ - 
        # All dates after Easter Monday:
        tS[tS > EasterMonday(currentYear)]
        
     ## Subset Start and End Date:
        c(start(tS), end(tS))

