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)

