I am quite new to R and I am mainly learning by visiting these Q&A sites. I initially wanted to post a comment on a previous question, that partially answerd my question, but was unable to beacause of my reputation, as I just became a member.
Link to question: https://stackoverflow.com/a/16160671/4681908
What I want to do is to create a new column that counts the unique values for a varialbe in my dataset for unique IDs. Instead of getting a list as the following code:
with(mydf, tapply(Spp, Cnty, FUN = function(x) length(unique(x))))
,I would like to code it to a new variable. Could anyone help me with this? I am sorry for any lack of information, and thank you in advance