Skip to content
Prev 333081 / 398503 Next

Bar Graph

On 11/13/2013 07:20 PM, Keniajin Wambui wrote:
Hi Keniajim,
It is not easy to work out what you want. If each serial number is an 
individual and you want the total number of individuals (dataset is 
"mydata"):

length(unique(mydata$serialno))

If you want the total number of individuals per year:

nind<-function(x) return(length(unique(x)))
year<-as.numeric(format(as.Date(mydata$date_admn,"%d-%b-%y"),"%Y"))
by(mydata$serialno,mydata$year,nind)

Perhaps this will give you a start.

Jim