[R] how to plot monthly mean data showing missing months

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Fri Sep 12 17:17:17 CEST 2008


> As per my attached script I am ploting monthly mean data which has 
missing
> months.
> But in the plot missing months are not shown (plot attached).
> Kindly help how to show complete plot (Jan-Dec) with missing months.

I don't accept scripts from strangers, but I guess the problem looks like 
this:
df <- data.frame(a=runif(5), b=c("Jan", "Feb", "Sep", "Jan", "Mar"))
histogram(~a|b, df)     #only four months plotted

df$b <- factor(df$b, levels=month.abb)  #force factor to have all months 
as levels
histogram(~a|b, df, drop.unused.levels=FALSE)   #12 months plotted

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list