similar to: substitute and expression

Displaying 20 results from an estimated 30000 matches similar to: "substitute and expression"

2007 Jul 19
1
substitute and expression (Peter Dalgaard)
In this connection, note the following > a4 <- 4 > plotThis <- bquote(alpha==.(a), list(a=a4)) > do.call(plot, list(1:10, main=do.call(expression, c(plotThis)))) > do.call(plot, list(1:10, main=do.call(expression, plotThis))) Error in do.call(expression, plotThis) : second argument must be a list > ## Whereas plotThis has class "call", c(plotThis) has class
2004 Apr 14
1
ltext, plotmath, and substitute
I am interested to use plotmath functions within a panel function but am having some problems getting the code right. Within each panel I am plotting the data, fitting a regression line, and would like to print the regression equation. Here is a trivial example of what I'd like to do: # generate simple data tmp.df <- data.frame(id = rep(1:4, each=4), time = rep(1:4, 4), das =
2010 Feb 02
2
character variables in substitute()
In trying to create a plotmath expression for plot labeling, such as R = 6, beta = 15 where I want beta to be the Greek beta and, possibly, R in italics (like one would get in an explicit expression. The reason for this is that I want to write a string builder function that takes vectors of variable names and their values and return a plotmath expression for labeling a plot. One approach I
2005 Mar 11
1
unexpected behaviour of expression(sum())
I'm seeing inconsistent symbols from the same expression with the following code: expr = expression(sum(x, 1, n)) plot(1, main = expr, type = "n") text(1, 1, expr) Moreover, the inconsistency is reversed in r-devel compared to R 2.0.1. In particular, the main label shows a \bigoplus instead of \sum in r-devel, and the other way round in 2.0.1. demo(plotmath) shows \sum in
2003 Feb 03
2
Mtext and xyplot
Dear all; I wish to create a graphic object combing an xyplot() and an mtext(). My code looks like following, gmv <- { trellis.device("windows", bg="white", width = 7, height = 7) xyplot(Mvol ~ Age | Nl * Th , data = Hft1, prepanel = function(x, y) prepanel.loess(x, y, span = 1), xlab =list(label = "Age (Years)", font = 2),
2007 May 04
2
Qt device update
Hi, a few days back I had asked for help on a Qt device package. Thanks to hints from Duncan TL and Thomas Friedrichsmeier, I now have something more or less functional. For those interested, It can be downloaded from http://dsarkar.fhcrc.org/R/R-Qt.html I have a couple of related questions. First, dev.interactive(), used in example() and many demo()-s to decide if the current device is
2005 Mar 18
3
plotmath question
R listers: I have been foiled by plotmath! (in R 2.01,Windows 2000) The task: Plot a normal density and label the ticks as mu - 3 sigma, mu - 2 sigma, ...., mu + 3 sigma, where the mu's and sigmas appear as Greek symbols, of course. The following code does this: x<-seq(-3,to=3,by=.01) y<-dnorm(x) plot(x,y,type='h',col='lightblue',axes=FALSE)
2012 Mar 16
2
variable values in plotmath expressions
## I would like help in using variable values in plotmath expressions ## in lattice x <- 1:10 y <- 1:10 pval <- .95 plot(y ~ x, ## works as I want in base graphics main=substitute(list(alpha * " = " * group("",list(p),"")), list(p=pval))) plot(y ~ x, ## doesn't work as intended: "pval" is displayed main=substitute(list(alpha *
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
2020 Oct 06
3
understanding as.list(substitute(...()))
I probably need to be more specific. What confuses me is not the use of substitute, but the parenthesis after the dots. It clearly works and I can make guesses as to why but it is definitely not obvious. The following function gives the same final result but I can understand what is happening. dots <- function (...) { exprs <- substitute(list(...)) as.list(exprs[-1]) } In the
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.
2012 Nov 14
2
vectorized plotmath expressions via substitute()
hi all - i've seen versions of this question before, but none seem to get directly at my solving my (probably very simple) issue: i simply want to annotate the tick marks on an axis with (superscripted) 10^x notation, and tried this: axis(1, at = axTicks(1), as.expression(substitute(10^foo, list(foo = axTicks(1)))) thinking the as.expression/substitute would create the appropriate
2004 Feb 17
2
Lattice graphics and strip function
I am looking for examples of code that demonstrates the fine tuning of the strip panels in lattice graphics and uses plotmath characters. The code for the graphic is as follows: xyplot(lagy ~ n | rho1 * rho2, data= data, layout=c(2,6), span = 1, xlab = "Sample Size", ylab = "Bias in the Coefficient for the Lag of X", type = "o") rho1 is a four level factor
2006 Dec 14
1
legend/plotmath/substitute problem
Dear R Experts, I am trying to produce a legend for a series of plots which are generated in a loop. The legend is supposed to look like this: 2000: gamma=1.8 where gamma is replaced by the greek letter and both the year and the value of gamma are stored in variables. Everything works fine as long as I have only one data series: year = 2001 g = 1.9 plot(1) legend('top',
2020 Oct 06
0
understanding as.list(substitute(...()))
Hi Tim, I have also asked a similar question a couple of months ago, and someone else did the same recently, maybe on r-devel. We received no "official" response, but Deepayan Sarkar (R Core Team member) claimed that: " There is no documented reason for this to work (AFAIK), so again, I would guess this is a side-effect of the implementation, and not a API feature you should
2000 Sep 12
1
Variable value in expression (plotmath)
Hello, I have a problem with the plotmath facility and haven't found any solution in the FAQ and Online-Help. I am trying to incorporate the value of a variable in an expression for an axis with plotmath. Considering having > gamma <- 10 I'd like to have a plot with > plot( .... , xlab=expression(gamma==10)) but depending on the true value of the variable. How can I
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
2006 Sep 14
3
converting strings to expressions
Hi, consider this: -------------- estr <- c("2^4", "alpha[1]") eexp <- expression(2^4, alpha[1]) ## Is it possible to get 'eexp' starting from 'estr'? The closest I could ## get was: do.call(expression, lapply(estr, as.name)) ## but it is not quite the same; e.g. the following behave differently: library(lattice) xyplot(1:10 ~ 1:10, scales
2004 Jul 29
2
expression + paste + arguments + ...
dear R wizards: I would like to write a function that roughly places the equivalent of the following latex text into the current plot: \newcommand{ \placesigma }[4]{ \put(\#1,\#2){ \sigma_{A , #3} = #4 } I cannot figure out how to do this. I know I have to use a function that uses expressions in a text() invoke. But passing arguments and nesting strings and expressions has so far not
2024 Mar 12
1
evince not showing "greek" and "math" in *.pdf plots
Hi I don't think this is an R issue (it is separate from the Cairo Symbol font problem). For PDF output, R actually relies on the Symbol font having the Adobe Symbol Encoding (Appendix D of the PDF Reference https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf) and just outputs the font as "Symbol", which relies on it being one of the Standard