Re: [R] For loop on column names

2014-01-18 Thread Bert Gunter
I doubt it. 1. The OP failed to specify how "populatedness" is defined. Is it NULL, NA, "", " ",...? 2. What is percent() ? Is this the OP's function or one from a package or pseudocode or ... ? 3. lapply(df,function) is generally preferable in R to: for(name in colnames(df)) function(df[ ,name

Re: [R] For loop on column names

2014-01-18 Thread Frede Aakmann Tøgersen
Hi Try for (cname in colnames(mydf)) print((percent(length(is.null(mydf [, cname]) / lines)) Br. Frede Oprindelig meddelelse Fra: Jeff Johnson Dato:18/01/2014 02.10 (GMT+01:00) Til: R help Emne: [R] For loop on column names I'm trying to find a more efficient to calculate t