mul                   package:Rsac                   R Documentation

_S_O_M_E _S_I_M_P_L_E _A_R_I_T_H_M_E_T_I_C

_D_e_s_c_r_i_p_t_i_o_n:

     These are provided as a matter of convience since any R functions
     can be easily applied to the vectors of SAC data (see below for
     examples). These functions apply basic arithmetic functions to
     each SAC data in a vector. The constant may be the same or
     different for each SAC file. If less constants are given than
     files in the vector, then the last constant provided is used for
     the remainder of the files, to be consistent with the behavior of
     the original SAC code.

_U_s_a_g_e:

     mul(s, c)
     add(s, c)
     pow(s, c)

_A_r_g_u_m_e_n_t_s:

       s: an object of class '"rsac"'.

       c: a constant to be applied to the data.

_V_a_l_u_e:

     same as input.

_A_u_t_h_o_r(_s):

     Eric M. Thompson <eric.thompson@tufts.edu>

_E_x_a_m_p_l_e_s:

     data(srosa)

     getunits(srosa)
     # Convert to m/s
     srosa <- mul(srosa, 1e-9)
     plot(srosa, xlim = c(150, 160))

     # this is also easy to do using the
     # lapply() function
     class(srosa)
     mode(srosa)

     # for all files

     m <- function(X){
            X$x <- X$x * 1e-9
            return(X) }
     srosa <- lapply(X = srosa, m)

     # Or individually:

     srosa[[1]]$x <- abs(srosa[[1]]$x)

