Using ifelse Within apply
问题 I am trying to make a new column in my dataset give a single output for each and every row, depending on the inputs from pre-existing columns. In this output column, I desire "NA" if any of the input vales in a given row are "0". Otherwise (if none of the inputs are 0), I want the output for that row to be the number of unique values of the inputs. I thought that the solution would use an ifelse function nested within an apply function, but I get an error that I do not understand. data$output