Byron Dom
2013-Oct-13 17:53 UTC
[R] How can I use a script "l" (LaTeX \ell) in mathematical annotation of plots?
Due to convention a script "l" - $$\ell$$ (LaTeX \ell) is used to represent a certain quantity in something I'm working on. I'm unable to figure out how to use it in R. It's not included in the list on ?plotmath. Can anyone tell me how to use it? Its unicode is U+2113. This page has a list of various encodings of it: http://www.fileformat.info/info/unicode/char/2113/encoding.htm. Is there a way to include it by using one of these encodings somehow? [[alternative HTML version deleted]]
Prof Brian Ripley
2013-Oct-13 20:06 UTC
[R] How can I use a script "l" (LaTeX \ell) in mathematical annotation of plots?
On 13/10/2013 18:53, Byron Dom wrote:> Due to convention a script "l" - $$\ell$$ (LaTeX \ell) is used to represent a certain quantity in something I'm working on. I'm unable to figure out how to use it in R. It's not included in the list on ?plotmath. > > Can anyone tell me how to use it? Its unicode is U+2113. This page has a list of various encodings of it: http://www.fileformat.info/info/unicode/char/2113/encoding.htm. Is there a way to include it by using one of these encodings somehow? > [[alternative HTML version deleted]]What do you want to do with it? plotmath is about plotting, but you have not otherwise mentioned that, let alone the device on which you want to plot. Read the help for plotmath: on some plot devices, just use "\u2113". It is not AFAICS in the Adobe symbol encoding. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Byron Dom
2013-Oct-23 23:39 UTC
[R] How can I use a script "l" (LaTeX \ell) in mathematical annotation of plots?
Original post: On 13/10/2013 18:53, Byron Dom wrote:>> Due to convention a script "l" - $$\ell$$ (LaTeX \ell) is used to >> represent a certain quantity in something I'm working on. I'm >> unable to figure out how to use it in R. It's not included in the >> list on ?plotmath. >> >> Can anyone tell me how to use it? Its unicode is U+2113. This >> page has a list of various encodings of it: >>http://www.fileformat.info/info/unicode/char/2113/encoding.htm.>> Is there a way to include it by using one of these encodings somehow?------------------------------------------------- On 13/10/2013 22:06 Prof Brian Ripley responded:> What do you want to do with it? plotmath is about plotting, but you > have not otherwise mentioned that, let alone the device on which you > want to plot. > > Read the help for plotmath: on some plot devices, just use "\u2113". It > is not AFAICS in the Adobe symbol encoding. > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel:+44 1865 272861 (self)> 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595------------------------------------------------- My response: Thanks I worked out how to do it based on your mention of "u2113". See below. I'm sorry if my information wasn't complete enough. I assumed that what I said, combined with the subject ("How can I use a script "l" (LaTeX \ell) in mathematical annotation of plots?") would have been enough. I just wanted to be able to do this on the default device, which displays plots within the R session window. I have a simple path to go from there to .png form, which I include in LaTeX documents and for other purposes. I am using R version 3.0.1 in Windows 7, for which I believe the default plot device is "windows". An example of the kind of thing I wanted to do is to include "ylab = expression(hat(gamma))" (which is equivalent to the LaTex "\hat{\gamma}}") among the base-graphics plot() arguments. That works. In LaTeX a script "l" is produced with "\ell", but something like "ylab = expression(ell)" doesn't work in R. I wanted to be able to do the equivalent of that, but to obtain "ℓ". Here are a couple of examples using it that worked: > plot(1:10,xlab="\u2113") > plot(1:10,xlab="\u2113(\u2113 + 1)") The only (slight) problem with this is the minor aesthetic issue that the "ℓ" one gets this way is in an obviously different font from what one gets using the LaTeX "\lambda" command/symbol. Strangely, earlier, when I tried > plot(1:10,xlab=expression(symbol("\u2113"))) it did the same thing as > plot(1:10,xlab=expression(lambda)) So I got a lower-case greek lambda - "λ", rather than "ℓ" (script "l"). When I used the unicode representation for lowercase lambda - "λ" - as follows > plot(1:10,xlab=expression(symbol("\u03bb"))) I got this for an x-axis label: "<Y+03BB>". On the other hand, the following did work > plot(1:10,xlab="\u03bb"), giving me an x-axis label of lambda - "λ". [[alternative HTML version deleted]]
Byron Dom
2014-May-07 05:54 UTC
[R] Using unbalanced-learning algorithms in the randomForest package.
The following report by the authors of the randomForest package describes two different algorithm modifications for using random forests to learn classifiers for "unbalanced" learning problems in which one class is much less frequent than the other (in 2-class problems). These two variations are called "balanced RF" and "weighted RF." http://statistics.berkeley.edu/sites/default/files/tech-reports/666.pdf Would someone please answer these three questions. (1) Is it possible to use the R randomForest package to learn random forests using either of these modified RF-learning algorithms? (2) If it is possible, how does one do it? (3) Is there some detailed documentation for running these modified versions? I've read the R package manual but it's too sketchy. It seems to be primarily for users who are already familiar with the package and just need to look up some detail like the name of an argument. [[alternative HTML version deleted]]