extendrange package:grDevices R Documentation _E_x_t_e_n_d _a _N_u_m_e_r_i_c_a_l _R_a_n_g_e _b_y _a _S_m_a_l_l _P_e_r_c_e_n_t_a_g_e _D_e_s_c_r_i_p_t_i_o_n: Extends a numerical range by a small percentage, i.e., fraction, _on both sides_. _U_s_a_g_e: extendrange(x, r = range(x, na.rm = TRUE), f = 0.05) _A_r_g_u_m_e_n_t_s: x: numeric vector; not used if 'r' is specified. r: numeric vector of length 2; defaults to the 'range' of 'x'. f: number specifying the fraction by which the range should be extended. _V_a_l_u_e: A numeric vector of length 2, 'r + c(-f,f) * diff(r)'. _S_e_e _A_l_s_o: 'range'; 'pretty' which can be considered a sophisticated extension of 'extendrange'. _E_x_a_m_p_l_e_s: x <- 1:5 (r <- range(x)) # 1 5 extendrange(x) # 0.8 5.2 extendrange(x, f= 0.01) # 0.96 5.04 ## Use 'r' if you have it already: stopifnot(identical(extendrange(r=r), extendrange(x)))