Hi. Am brand new to R and to mailing lists - have never posted anywhere
before, so hope I do this right.

Am using R 2.9.1 with lattice graphics (just installed, fully up to date).

Am doing trellis xyplot with y (emp=employment), x (yearmo=a time measure)
and conditioning variable (indf - factor describing industry) -- i.e., (emp
~ yearmo | indf), where all three variables are in a dataframe. The
conditioning variable is a factor with a long text description (e.g.,
"Offices of bank holding companies and of other holding companies
(60551112)" constructed from a much-less-descriptive industry code - in this
case, 60551112). That long text goes into the strip text above each panel.
With default settings the text for many of the factor levels is too long for
the strip area and I simply see some of it but not all of it. I would like
to be able to see the full text description, which means I would like to
allow it to wrap over several lines in the strip area - say 2 or 3 lines.
Note that the text itself does NOT have any embedded line-wrap characters
(\n) and I would like to avoid writing something to guess where to insert
them into each of more than 1,000 levels of the factor. I suspect that
xyplot, perhaps through par.strip.text, has some simple way of allowing it
to do intelligent line wrap. I have searched high and low, but have not
figured this out:
- I have read the lattice documentation but haven't quite figured out from
that what I should do
- I have tried using lines=2 in par.strip.text and lineheight=2 but the
former appears to change the height of the strip area without forcing line
wrap, and the latter as I understand it controls spacing between lines
- I have tried workarounds like using cex=0.2 in par.strip.text to make the
text really small, but it gets hard to read; and I have tried
abbreviate=TRUE in par.strip.text but I would rather have full titles

I am sure there is a really simple solution to this but I can't figure it
out. If anyone could tell me how I can get long strip titles in xyplot to
wrap lines (without inserting "\n"s in them) I would appreciate it greatly.

Thanks!

Don Boyd

To be more concrete, here is sample code, stripped to its essentials. indf
is the factor that has very long text for some of its levels:

xyplot(emp ~ yearmo | indf,
  data = subset(empall, subset=(yearmo>=as.Date("2006/12/01"))),
  scales = list(relation="free", x = list(rot = 45)),
  type = "b",
  par.strip.text = list(lines=2, cex=.6),
  layout=c(4,3),
  xlab=NULL,
  # put reference lines on the plot
  panel=function(...){
   panel.xyplot(...)
   panel.abline(h=seq(-10,5,by=1))
  }
  )

	[[alternative HTML version deleted]]


