capture.output package:utils R Documentation _S_e_n_d _o_u_t_p_u_t _t_o _a _c_h_a_r_a_c_t_e_r _s_t_r_i_n_g _o_r _f_i_l_e _D_e_s_c_r_i_p_t_i_o_n: Evaluates its arguments with the output being returned as a character string or sent to a file. Related to 'sink' in the same way that 'with' is related to 'attach'. _U_s_a_g_e: capture.output(..., file = NULL, append = FALSE) _A_r_g_u_m_e_n_t_s: ...: Expressions to be evaluated. file: A file name or a connection, or 'NULL' to return the output as a character vector. If the connection is not open, it will be opened initially and closed on exit. append: logical. If 'file' a file name or unopened connection, append or overwrite? _D_e_t_a_i_l_s: An attempt is made to write output as far as possible to 'file' if there is an error in evaluating the expressions, but for 'file = NULL' all output will be lost. _V_a_l_u_e: A character string (if 'file=NULL'), or invisible 'NULL'. _S_e_e _A_l_s_o: 'sink', 'textConnection' _E_x_a_m_p_l_e_s: require(stats) glmout <- capture.output(example(glm)) glmout[1:5] capture.output(1+1, 2+2) capture.output({1+1; 2+2}) ## Not run: ## on Unix with enscript available ps <- pipe("enscript -o tempout.ps","w") capture.output(example(glm), file=ps) close(ps) ## End(Not run)