How to get events per month barplot in R

# generate some random data

dat = data.frame(timestamp = Sys.time() + sort(round(runif(1000, (24*3600), (2*365*24*3600)))))

# create new columns to identify the month and year
dat$month = strftime(dat$time, “%b”)
dat$year = strftime(dat$time, “%Y”)

# count the timestamps per month for each year
timestamps_month = count(dat, vars = c(“month”,”year”))

# create the plot graph
ggplot(data = timestamps_month) + geom_bar(aes(x = month, y = freq, fill

Continue reading […] How to get events per month barplot […]


How to remove (almost) everything from the work environment


This command will clear the variables and the loaded libraries. Almost.

If we run ?rm we get the following info:

## remove (almost) everything in the working environment.
## You will get no warning, so don’t do this unless you are really sure.
rm(list = ls())



R 3.2.0 is here

Upgraded to R 3.2.0 today.

From the prompt i used: