Q: Map ggplot2 title to a variable in a dlply call set.seed(8)    
df <- data.frame(
      v1 = rep(c("A","B","C"),25),
      v2 = runif(75,0,2),
      v3 = sample(c("cat1", "cat2", "cat3"), 75, replace=T))

Plot three plots in a d_ply() (or dlply()), splitting over v3 
require(plyr)
    d_ply(df, .(v3), .print=T, function(x){
    ggplot(x,aes(v1, v2)) +
    geom_point()})

How do I specify some annotation using variables (legends, titles). For instance the title of each plot should be mapped to the v3 variable. With reference to this post this doesn't work for me: 
d_ply(df, .(v3), .print=T, function(x){
    ggplot(x,aes(v1, v2)) + 
    theme(title=v3) +
    geom_point()})

Nor does theme(title=unique(v3)). Maybe it is something about have I access v3in d_lpy() ?

A: You should use ggtitle and not just v3, but x$v3.
d_ply(df, .(v3), .print=T, function(x){
  ggplot(x,aes(v1, v2)) + 
    ggtitle(x$v3) +
    geom_point()})

