SyntaxFix
Write A Post
Hire A Developer
Questions
This should do the trick:
ddply(myvec,~name,summarise,number_of_distinct_orders=length(unique(order_no)))
This requires package plyr.