Dear R-help community: I have been searching for an elegant solution to the question posed in my subject. I would like to be able to use any of the R functions like text() or mtext() to display some text with mixed font families. For example, a label like "huge-class background load", where the word "huge" is in Courier and the rest is in the default family (or any other family for that matter). I will ultimately be saving to EPS files, so I know the correct families need to be included when I open the device. So far I have fiddled with plotmath to no avail. I also know that I can place the first and remaining words with separate calls to a text function and something like strwidth() for proper positioning, but I never quite seem to get that right. I suppose that the family needs to be taken into account to compute the string width, and that doesn't seem to happen. Is there an easier way that does the calculations automatically? Any help is much appreciated. Regards, Marc -- Marc Chiarini CompSci PhD Candidate Tufts University Medford, MA 02155 http://www.cs.tufts.edu/~mchiar01
Hi I can't necessarily do elegant, but see https://stat.ethz.ch/pipermail/r-help/2009-August/208092.html (Solution 4) for an example of setting up two different fonts within a single font "family" on PDF (PostScript is very similar) and using plotmath to produce text that uses the two different fonts. Paul Marc Chiarini (Tufts) wrote:> Dear R-help community: > > I have been searching for an elegant solution to the question posed in > my subject. I would like to be able to use any of the R functions like > text() or mtext() to display some text with mixed font families. For > example, a label like "huge-class background load", where the word > "huge" is in Courier and the rest is in the default family (or any other > family for that matter). I will ultimately be saving to EPS files, so I > know the correct families need to be included when I open the device. > So far I have fiddled with plotmath to no avail. I also know that I can > place the first and remaining words with separate calls to a text > function and something like strwidth() for proper positioning, but I > never quite seem to get that right. I suppose that the family needs to > be taken into account to compute the string width, and that doesn't seem > to happen. Is there an easier way that does the calculations automatically? > > Any help is much appreciated. > > Regards, > Marc > >-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Hello R-help community: I have what I think is a simple question that I hope someone can answer. When using the median() function on any zoo object (in particular, mine is an irregular time series), I get the following error, which is thrown from .gt(): Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L : argument is of length zero median() of course works fine on the coredata() of my zoo object, but not on the object itself. Is the median.default function coded incorrectly for zoo objects? If not, then I don't understand why functions like mean() and sd() work correctly on the same zoo object, but not median(). Am I asking the right questions? Thanks for any help you can offer. Regards, Marc