R frequency table, how do I count observations only if first observation by other variable
I have a table in which I need to count the number of patient having a certain condition, or if not or if no info is available. Ideally, for each patient, there is the same information about cond in each line of the data, but sometimes the data contains errors, as illustrated by the first line that should have cond=1.