i have data frame contains quarter , unique customer id columns want plot graph count unique customers quarter.
what tried
uniquegraph<-data.frame(uniquecustomerdf) > uniquecustomer<-c(uniquegraph$customer.id) > quarter<-c(uniquegraph$quarter) > uniquegraphplot<-data.frame(uniquecustomer=uniquecustomer,quarter=quarter) > ggplot(uniquegraphplot,aes(x=quarter,y=uniquecustomer)) + geom_bar(stat="identity")
and tried hist
hist(uniquecustomer, plot=true)
but here how assign quarter not getting
here data
quarter customer.id 2009 q1 10025 2009 q1 10096 2009 q1 10062 2009 q1 10030 2009 q1 10037 2009 q1 10078 2009 q1 10032 2009 q1 10243 2009 q1 10052 2011 q1 10019 2009 q4 13710 2009 q4 15310 2009 q4 13814 2010 q3 13210 2009 q4 10143
assuming customer id unique, might solution:
# df--> posted data # converting string factor df[ ,1] <- factor(df[,1]) # here standard r produce plot: plot(df[,1])
# if prefer eg. ggplot require(ggplot2) qplot(df[,1]) + ylab("frequency")+xlab("quarters")+ geom_bar(fill="lightblue")
hth