Displaying 1 result from an estimated 1 matches for "abctasknum".
2008 Jan 22
1
row-wise conditional update in dataframe
...alues in
other fields and can't find even how to search for this right. Sorry
if this has been asked before.
But, specifically, I have a 490 X 221 dataframe and need to count, by
row, how many fields in Dataframe$field_a...Dataframe$field_zz are
non-null and enter this value in Dataset$ABCtaskNum. I have field
name definitions in a vector "vars" and tried writing a custom
function to handle the within-row calculation
myfunct <-function () {for (i in 1:length(vars)) {if (vars[i] != NA)
{Dataset$ABCtaskNum<-Dataset$ABCtaskNum+1}}}
and then use "apply" to hand...