Hi, On Mon, Apr 6, 2015 at 7:44 AM, Christine Lee via R-help <r-help@r-project.org> wrote: > To whom it may help, > > I am new to R. > > I have been tring to have a lattice plot in two strip levels: 4 stations in 2 > years. > > I type in: > > histogram(~Raw.no10$Width|Raw.no10$Station*Raw.no10$Year, data=Raw.no10, > layout=c(4,2),nin=30,xlab="Prosomal Width (mm)", > strip=strip.custom(bg='white'),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE)
In both examples, you're mis-stating the data. Given the data argument, you do not need to restate the data source. histogram(~Width | Station*Raw.no10$Year, data=Raw.no10, layout=c(4,2),nin=30,xlab="Prosomal Width (mm)", strip=strip.custom(bg='white'),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE) If that doesn't solve your problem, then please use dput(head(Raw.no10), 20) to provide some example data, or create fake data of the same structure. Without a reproducible example that includes some sample data (fake is fine), the code you used, and some clear idea of what output you expect, it's impossible to figure out how to help you. Here are some suggestions for creating a good reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example > The second level, i.e. Year, showed as "Raw.no10$Year" in the each of the > lattice plot, instead of its respective year, such as "2002" and "2014". > > I changed to the following programme language, therefore: > > histogram(~Raw.no10$Width|Raw.no10$Station*Raw.no10$Year, data=Raw.no10, > layout=c(4,2),nin=30,xlab="Prosomal Width (mm)", > strip=strip.custom(bg='white',var.name=c("2002","2014")),ylab="Frequencies",tick=-1,col='grey',as.table=TRUE) > > in order to specify the variable names of the strip. > > Instead of showing "Raw.no10$Year", each of the lattice plot states "2014"! > They should have 4 plots showing "2002" and another 4 showing "2014". > > Could any one help indicating what has gone wrong? > > I am really helpless and frustrated now. T_T > > Regards, > Christine -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.