I am trying to get a simple bar char of activity count by date; however, when I import my data into R, it either skipping some record or not properly converting the date format.
Here is the script I am using:
ua <- read.table('report_users_activities_byrole 2.txt',sep='|',header=T)
qplot(date,
data=ua,
geom="bar",
weight=count,
ylab="User Count",
fill=factor(un_region)) +
opts(axis.text.x =theme_text(angle=45, size=5))
And my date
head(ua)
date role name un_region un_subregion us_state count
1 2012-06-21 ENTREPRENEUR Australia Oceania Australia and New Zealand 2
2 2012-06-21 ENTREPRENEUR Belgium Europe Western Europe 1
3 2012-06-21 ENTREPRENEUR Bosnia and Herzegovina Europe Southern Europe 1
Not sure what’s wrong with your code but something like this should work (that’s a version of the example at http://had.co.nz/ggplot2/scale_date.html)
dfis a data.frame where some dates appear more often than others (that’s the sample() function). not sure why you want the “weight” argument in your qplot() call. Also make sure your date variable is a proper date (not a string), i.e. dootherwise
should work as well.