Math Group Method for Data Frame Objects

DESCRIPTION:

This is a group method for functions of the Math group.

USAGE:

fun(x, digits) 

REQUIRED ARGUMENTS:

x
any object for which the relevant function, fun, from the Math group, inherits from class "data.frame".

OPTIONAL ARGUMENTS:

digits
digits arguments for the round and signif functions.

VALUE:

a data frame, each variable of which will have been transformed by the generic function.

DETAILS:

This is a group method for the functions of the Math group ( sin(), log(), round() , etc), which are essentially all functions that return a one-to-one numerical transformation of their (numeric) argument. This method will generally result in an error unless all the variables in the data frame are numeric vectors or numeric matrices.

EXAMPLES:

# round all the non-factors in a data frame 
round(wafer[, sapply(wafer, function(x) !inherits(x,"factor"))], 2)