allequal                package:spam                R Documentation

_T_e_s_t _i_f _T_w_o '_s_p_a_m' _O_b_j_e_c_t_s _a_r_e (_N_e_a_r_l_y) _E_q_u_a_l

_D_e_s_c_r_i_p_t_i_o_n:

     Utility to compare two 'spam' objects testing 'near equality'. 
     Depending on the type of difference, comparison is still made to
     some extent, and a report of the differences is returned.

_U_s_a_g_e:

     all.equal.spam(target, current, tolerance = .Machine$double.eps^0.5,
         scale = NULL, check.attributes = FALSE,...)

_A_r_g_u_m_e_n_t_s:

  target: a 'spam' object.

 current: another 'spam' object to be compared with 'target'.

tolerance: numeric >= 0.  Differences smaller than 'tolerance' are not
          considered.

   scale: numeric scalar > 0 (or 'NULL'). See 'Details'.

check.attributes: currently not yet implemented.

     ...: Further arguments for different methods.

_D_e_t_a_i_l_s:

     Numerical comparisons for 'scale = NULL' (the default) are done by
     first computing the mean absolute difference of the two numerical
     vectors.  If this is smaller than 'tolerance' or not finite,
     absolute differences are used, otherwise relative differences
     scaled by the mean absolute difference.

     If 'scale' is positive, absolute comparisons are made after
     scaling (dividing) by 'scale'.

     Don't use 'all.equal.spam' directly in 'if' expressions-either use
     'isTRUE(all.equal.spam(....))' or 'identical' if appropriate.

     Cholesky decomposition routines use this function to test for
     symmetry.

     A method for 'matrix-spam' objects is defined as well.

_V_a_l_u_e:

     Either 'TRUE' or a vector of 'mode' '"character"' describing the
     differences between 'target' and 'current'.

_A_u_t_h_o_r(_s):

     Reinhard Furrer

_E_x_a_m_p_l_e_s:

     obj <- diag.spam(2)
     obj[1,2] <- .Machine$double.eps

     all.equal( diag.spam(2), obj)

     all.equal( t(obj), obj)

     all.equal( t(obj), obj*1.1)

     # We can compare a spam to a matrix
     all.equal(diag(2),diag.spam(2))

     # the opposite does often not make sense,
     # hence, it is not implemented.
     all.equal(diag.spam(2),diag(2))

