This can be done using a similar style but without a loop by
using sapply over the indexes rather than over the columns:
sapply(1:ncol(X), f)
f <- function(i) {...whatever...}
...whatever... can now refer to colnames(X)[i] and X[,i]
On 8/28/06, Sundar Dorai-Raj <[EMAIL PROTECTED]> wrote:
>
>
> N
Nick Desilsky wrote:
> Hi,
>
> any good trick to get the column names for title() aside from running
> lapply on the column indexes?
>
> Thanks
>
> Nick.
>
> apply(X[,numCols],2,function(x){
> nunqs <- length(unique(x))
> nnans <- sum(is.na(x))
> info <- paste("un
Hi,
any good trick to get the column names for title() aside from running lapply
on the column indexes?
Thanks
Nick.
apply(X[,numCols],2,function(x){
nunqs <- length(unique(x))
nnans <- sum(is.na(x))
info <- paste("uniques:",nunqs,"(",nunqs/n,")","NAs:",nnans,"(",nn