Displaying 1 result from an estimated 1 matches for "calcmyattr".
2008 Oct 29
0
Propagate vector attributes to data frame
...nsformation value (myAttr) for x, transforms x according to myAttr
and then sets myAttr as an attribute of x before returning x, so I can
easily know what myAttr was used (basically it's a power transformation
and myAttr is the lambda).
myFunction.numeric <- function(x, ...) {
myAttr <- calcMyAttr(x, ...)
x <- myTransform(x, myAttr, ...)
attr(x, "myAttr") <- myAttr
return(x)
}
To apply it over several columns of a data.frame, I have the following
function:
myFunction.data.frame <- function(df, ...) {
df <- apply(df, 2, myFunction , ...)
}
myDataFrame[cols] <-...