cut.POSIXt package:base R Documentation _C_o_n_v_e_r_t _a _D_a_t_e _o_r _D_a_t_e-_T_i_m_e _O_b_j_e_c_t _t_o _a _F_a_c_t_o_r _D_e_s_c_r_i_p_t_i_o_n: Method for 'cut' applied to date-time objects. _U_s_a_g_e: ## S3 method for class 'POSIXt': cut(x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ...) ## S3 method for class 'Date': cut(x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ...) _A_r_g_u_m_e_n_t_s: x: an object inheriting from class '"POSIXt"' or '"Date"'. breaks: a vector of cut points _or_ number giving the number of intervals which 'x' is to be cut into _or_ an interval specification, one of '"sec"', '"min"', '"hour"', '"day"', '"DSTday"', '"week"', '"month"', '"quarter"' or '"year"', optionally preceded by an integer and a space, or followed by '"s"'. For '"Date"' objects only '"day"', '"week"', '"month"', '"quarter"' and '"year"' are allowed. labels: labels for the levels of the resulting category. By default, labels are constructed from the left-hand end of the intervals (which are include for the default value of 'right'). If 'labels = FALSE', simple integer codes are returned instead of a factor. start.on.monday: logical. If 'breaks = "weeks"', should the week start on Mondays or Sundays? right, ...: arguments to be passed to or from other methods. _D_e_t_a_i_l_s: Using both 'right = TRUE' and 'include.lowest = TRUE' will include both ends of the range of dates. Using 'breaks = "quarter"' will create intervals of 3 calendar months, with the intervals beginning on January 1, April 1, July 1 or October 1, based upon 'min(x)' as appropriate. _V_a_l_u_e: A factor is returned, unless 'labels = FALSE' which returns the integer level codes. _S_e_e _A_l_s_o: 'seq.POSIXt', 'seq.Date', 'cut' _E_x_a_m_p_l_e_s: ## random dates in a 10-week period cut(ISOdate(2001, 1, 1) + 70*86400*stats::runif(100), "weeks") cut(as.Date("2001/1/1") + 70*stats::runif(100), "weeks")