Displaying 1 result from an estimated 1 matches for "newout".
Did you mean:
ewout
2012 May 24
1
use list as function arguments
...9;m going about this the
wrong way?
format_cols <- function(x, format_list = list()) {
# usage: length(format_list) must equal ncol(x)
# format list should be a list of lists of key=value pairs
corresponding to format settings for each column
if (is.data.frame(x)) {
newout = data.frame()
} else if (is.matrix(x)) {
newout = matrix()
}
for (i in 1:ncol(x)){
newout = cbind(newout, format(x,format_list[[i]]))
x[,i] = format(x,format_list[[i]])
}
return(newout)
}
Thanks,
Allie