delete.response package:stats R Documentation _M_o_d_i_f_y _T_e_r_m_s _O_b_j_e_c_t_s _D_e_s_c_r_i_p_t_i_o_n: 'delete.response' returns a 'terms' object for the same model but with no response variable. 'drop.terms' removes variables from the right-hand side of the model. There is also a '"[.terms"' method to perform the same function (with 'keep.response=TRUE'). 'reformulate' creates a formula from a character vector. _U_s_a_g_e: delete.response(termobj) reformulate(termlabels, response = NULL) drop.terms(termobj, dropx = NULL, keep.response = FALSE) _A_r_g_u_m_e_n_t_s: termobj: A 'terms' object termlabels: character vector giving the right-hand side of a model formula. Cannot be zero-length. response: character string, symbol or call giving the left-hand side of a model formula, or 'NULL'. dropx: vector of positions of variables to drop from the right-hand side of the model. keep.response: Keep the response in the resulting object? _V_a_l_u_e: 'delete.response' and 'drop.terms' return a 'terms' object. 'reformulate' returns a 'formula'. _S_e_e _A_l_s_o: 'terms' _E_x_a_m_p_l_e_s: ff <- y ~ z + x + w tt <- terms(ff) tt delete.response(tt) drop.terms(tt, 2:3, keep.response = TRUE) tt[-1] tt[2:3] reformulate(attr(tt, "term.labels")) ## keep LHS : reformulate("x*w", ff[[2]]) fS <- surv(ft, case) ~ a + b reformulate(c("a", "b*f"), fS[[2]]) stopifnot(identical( ~ var, reformulate("var")), identical(~ a + b + c, reformulate(letters[1:3])), identical( y ~ a + b, reformulate(letters[1:2], "y")) )