i am trying to count how many numbers are greater than zero in a data frame. the data frame has a labels like "xx", which are characters; and the original data frame looks like:
dataframe
"xx" 13,NA,9,NA,NA,NA
"xx" 2,1,NA,NA,NA,NA
"cc" NA,NA,NA,NA,NA,NA
"cc" 59,50,2,5,1,NA
"xx" 20,10,1,NA,NA,NA . . .
first i replace missing values with zeros, classified different labels into groups ,and then try to count. i tried sum( dataframe>0); and length(which(dataframe>0)) which i assume are the same because they get same output, but not correct.
could anyone help?
thanks.
