[R] xyplot format axis

taz9 alienz747 at gmail.com
Tue Jun 16 16:24:40 CEST 2009


Hi All,

I'm trying to format the y-axis in an xyplot to show numbers with a comma
separating the thousands but I'm not able to do it using formatNum(y,
big.mark=","). This is what I have:

library(lattice)

year<-c(2003,2004,2005,2006,2007,2008,2003,2004,2005,2006,2007,2008)
dept<-c("Politics","Politics","Politics","Politics","Politics","Politics","Sociology","Sociology","Sociology","Sociology","Sociology","Sociology")
awards<-c(859742,1346337,1841238,1104794,2192130,237253,1736600,1570843,4947761,4587803,2314805,2762599)
df1<-data.frame(year,dept,awards)

xyplot(awards~year|dept, data=df1, type="o",
scales=list(y=list(alternating=3),x=list(alternating=1)),
          panel = function(...) {
             panel.grid(h = -1,v = 0, lty="dotted")
             panel.xyplot(...)
})

Any ideas are much appreciated.



-- 
View this message in context: http://www.nabble.com/xyplot-format-axis-tp24055476p24055476.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list