similar to: math symbols and text with mtext()

Displaying 20 results from an estimated 7000 matches similar to: "math symbols and text with mtext()"

2007 Apr 17
2
Use of argument '...'
Dear R list, I've read the function writing sections on both "An introduction to R" and "R language Definition" manuals but still don't understand why the following gives an error message: fun <- function(x, ...) x + y fun(1, y=2) I get: Error in fun(1, y = 2) : object "y" not found I'd appreciate any help in understanding this. R version 2.4.1
2006 Jun 23
1
numeric variables converted to character when recoding missing values
Dear R helpers, I have a data frame where missing values for numeric variables are coded as 999. I want to recode those as NAs. The following only partially succeeds because numeric variables are converted to character in the process: df <- data.frame(a=c(999,1,999,2), b=LETTERS[1:4]) is.na(df[2,1]) <- TRUE df a b 1 999 A 2 NA B 3 999 C 4 2 D is.numeric(df$a) [1] TRUE
2008 Aug 07
1
Mtext doesn't display characters in italic when I use a greek symbol
Following on from my previous mail! plot(1:10,1:10) mtext("title", side=3, adj=0, font=3, cex=1.5) This works as expected and puts the font in italics. tag <- "A)" suffix <- "genea::" plot(1:10,1:10) mtext(bquote(.(tag) ~ Delta * .(suffix)), side=3, adj=0, font=3, cex=1.5) Here, the font isn't in italics, it's normal. I presume this is some
2007 Jun 19
3
Controlling text and strip arrangement in xyplot
I've searched the archives and read the xyplot help but can't figure out the 2 lattice questions below? Consider: library(lattice) DF <- data.frame(x=rnorm(20), y=rnorm(20), g1=rep(letters[1:2], 10), g2=rep(LETTERS[1:2], each=10), g3=rep(rep(letters[3:4],each=5),2)) xyplot(y ~ x | g1 + g2, groups=g3, data=DF) 1) Is there a way to get one strip per row and column
2010 Aug 01
3
Constructing arguments for plotmath
Colleagues, I am encountering difficulty adding formatted text to a graphic. Specifically, I want to add a superscript in the middle of a text string but I would like to format the text string on the fly. The commands: plot(1,1) ARG <- bquote('TEXT'^'\u00ae') mtext(ARG, line=-2, side=1) yield the desired output. However, my goal is to paste together a string, then pass
2007 May 25
1
Speeding up resampling of rows from a large matrix
I'm trying to: Resample with replacement pairs of distinct rows from a 120 x 65,000 matrix H of 0's and 1's. For each resampled pair sum the resulting 2 x 65,000 matrix by column: 0 1 0 1 ... + 0 0 1 1 ... _______ = 0 1 1 2 ... For each column accumulate the number of 0's, 1's and 2's over the resamples to obtain a 3 x 65,000 matrix G. For those
2009 Mar 11
2
Combining math and variables in expression
I am trying to get the following line in a plot margin using mtext: 100% Area = 120.000 km^2 Where I intend that "100% Area =" is text, 120.000 is a number that varies according to different data, and km^2 should be a neat km-with-superscript-2. The expression function fails me, since it apparently cannot coerce an expression when a variable is involved. In the R help file there is
2023 Jun 08
2
need help with plotmath and/or plotting unicode characters
R 4.2.3 OS X Colleagues This should be easy -- but not for me. I want to plot text similar to this: N ? XX: YY where XX can be either 1 or 50 and YY is an integer I envision that there would be two solutions: UNICODE: If I can generate "?" via unicode, the problem is solved: mtext(side=3, paste0("N ", UNICODE, " ", XX, ": ", YY)) PLOTMATH:
2007 May 15
1
Efficiently reading random lines form a large file
I need to read two different random lines at a time from a large ASCII file (120 x 296976) containing space delimited 0-1 entries. The following code does the job and it's reasonable fast for my needs: lineNumber = sample(120, 2) line1 = scan(filename, what = "integer", skip=lineNumber[1]-1, nlines=1) line2 = scan(filename, what = "integer",
2007 Oct 18
2
image quality of plot inserted into PowerPoint
Dear R-helpers, I need to insert an R (2.6.0) generated plot containing semi-transparent colors into PowerPoint (2002). When I directly paste it from the clipboard or insert it as (enhanced) Metafile (I'm on Windows XP) the semi-transparent colors don't show. When I insert it at as a Bmp, Png or Jpeg and then convert to PDF the semitransparent colors do show but the quality of the image
2008 Jun 25
0
Use plotmath expressions read from a text file in mtext/bquote
Hello R-help List I am writing some R scripts to create graphs of water quality trends that will be called by a web service running R. The axis titles will need to change as the input data (ie. water quality variable) changes according to a user's choice made via a web page. The way I am currently passing call-specific parameters to the R script is via a text file created on the fly by the
2010 Jan 23
1
Failure to produce italics in jpeg
Colleagues, Using R 2.10.1 in OS X (Snow Leopard), I created JPEG documents that were intended to include italicized text. In the JPEG versions, the italics appear in bold-face. The identical code (except for the call to the device) yields italics in PDF. A minimal example is: PDF version: > pdf("plot.pdf") > plot(1,1) > mtext(bquote(italic(P) < .(0.005))) >
2017 Aug 18
1
bquote question
Dear All, could you please provide input on the following: plot(1:10,main=paste("\n ","\nABCD","\n ","\n ","\n "),cex.main=1.3) a<-500 b<-12 mtext(bquote(bold(.(formatC(1.2*a,decimal.mark=",",digits=2,format="f")))~ " words "~bold(.(b))~" words"~"\n "~"\n "))
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
Greetings: I would like comments on this example and after fixing it up, I need help from someone who has access to insert this in R's help page for plotmath. I uploaded a drawing http://pj.freefaculty.org/R/Normal-2009.pdf that is created by the following code http://pj.freefaculty.org/R/Normal1_2009_plotmathExample.R This will be a good addition to the plotmath help page/example.
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9. I've been experimenting with plotmath. I wish it were easier to combine expressions in plotmath with values from the R program itself. There are two parameters in the following example, the mean "mymean" and standard deviation "mystd". I am able to use bquote to write elements into the graph title like mu = mymean and R will
2006 Sep 13
2
Retrieving value computed in inner function call
Dear R users, Consider the following example function: f = function(a,b) { g = function(x) a*x + b h = function(x) g(x)^2 + x^2 opt = optimize(h,lower = -1, upper = 1) x.min = opt$minimum h.xmin = opt$objective g.xmin = g(x.min) return(c(x.min, h.xmin, g.xmin)) } In my real problem the function that plays the role of "g" is costly to compute. Now, to
2010 Jan 21
1
Displaying Equation With Numerator and Demomenator On A Plot...
Is there a way to display something like the quadratic equation, i.e. with a numerator and demonator on a plot? I think there is a way to create the equation in Latex, but wasn't sure if this format would translate to plotting. \begin{equation} ? x = \frac{b +/- sqrt(b^2 - 4*a*c)}{2*a} \end{equation} ? My searched turned up the following:
2010 Jul 06
1
plotmath vector problem; full program enclosed
Here's another example of my plotmath whipping boy, the Normal distribution. A colleague asks for a Normal plotted above a series of axes that represent various other distributions (T, etc). I want to use vectors of equations in plotmath to do this, but have run into trouble. Now I've isolated the problem down to a relatively small piece of working example code (below). If you would
2012 Jun 20
2
Figure title
Hi, I created several figures and their titles should appear like this: Figure 1: Monte Carlo results for alternative estimators of structural parameters (N = 100, T = 5) Because N and T change across figures, my code includes the following lines: N.set <- 100 T.set <- 5 mtext(“Figure 1: Monte Carlo results for alternative estimators of structural
2012 Aug 15
3
How to join two plotmath type expressions
If I have two variables set, one of which holds an expression, for example: > label <- 'Temperature' > unit <- expression(paste(degree,'C')) how can I join them together for use in mtext (or equivalent)? The following is conceptually what I want to do, but will obviously not work: > plot(0:1) > mtext(paste(label,unit)) Preferably, I would like this to work