Displaying 20 results from an estimated 287 matches for "bquote".
Did you mean:
quote
2010 Jan 25
2
Two == expressions in bquote
Hi,
I want to put text on a plot containing something like: a = b^2 = <squared numeric value of b> using bquote.
Example:
mu = 5
plot(1:10,1:10)
text(2,8, bquote(delta == mu^2)) # This works
text(2.5,8, bquote(phantom(0) == .(mu^2))) # but is unpredictable
text(2,8, bquote(delta == mu^2 == .(mu^2))) # This doesn't work
The last text function returns the error:
Error: unexp...
2010 May 07
0
A fix that for 'bquote' that may work (PR#14031)
--- On Fri, 6/11/09, tlumley at u.washington.edu <tlumley at u.washington.edu> wrote:
> From: tlumley at u.washington.edu <tlumley at u.washington.edu>
> Subject: Re: [Rd] A fix that for 'bquote' that may work? (PR#14031)
> To: suharto_anggono at yahoo.com
> Cc: r-devel at stat.math.ethz.ch, R-bugs at r-project.org
> Date: Friday, 6 November, 2009, 11:42 PM
> On Thu, 5 Nov 2009, suharto_anggono at yahoo.com
> wrote:
>
> > This is a fix for 'bquote' that...
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 it to mtext. For example:
plot(1,1)
PART1 <- 'TEXT'
PART2 <- '^'
PART3 <- '\u00ae'
ARG <- paste(PART1, PART2...
2008 Oct 02
1
using bquote to construct function
Hi, R-help,
(sessionInfo at the end)
I'm trying to construct a function using bquote and running into a
strange error message. As an example, what I would like to do is this:
z <- 2
eval(bquote(function(x, y) { x^.(z) + y }))(2, 3)
However, I get the following:
Error in eval(expr, envir, enclos) :
invalid formal argument list for "function"
However, if I change...
2006 Jul 30
3
main= bquote(paste("Results for ", beta, "3", ==.(b1)))) doesn't work.
Hi,
I need to plot the beta as the symbol, followed by the index 3 as the title of a graph.
This code works> main= bquote(paste("Results for ", beta ==.(b1))
but I also need the index 3.
I tried (simplified):
>plot(x,y, main= bquote(paste("Results for ", beta, "3", ==.(b1))))
and a few other versions, but I can not get it to run properly.
Any help would be greatly appreciated,
T...
2009 Oct 29
0
In the result of applying 'bquote' to function definition with 2 or more arguments, first function argument disappears (PR#14031)
Full_Name: Suharto Anggono
Version: 2.8.1
OS: Windows
Submission from: (NULL) (125.165.81.124)
Sorry for repost. There is already PR#9602, but the problem is still there.
There is also a post "Re: [R] using bquote to construct function" in R-help
2008-10-02.
This illustrates the problem.
C:\Program Files\R\R-2.8.1\bin>R --vanilla
R version 2.8.1 (2008-12-22)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY....
2009 Sep 02
2
combining grid.text, expression and variables
Dear R-users,
I am trying to use the grid.text and expression functions to display
several character strings and plotmath text on a viewport. Some strings
can include a variable portion (PI.limits in the following example),
which I thought could be implemented by combining the bquote and the
expression functions. Unfortunately, my expressions do not seem to be
evaluated. I would greatly appreciate if somebody could tell me where my
mistake(s) is(are).
Thank you in advance
###### 8< #######
library(grid)
PI.limits <- c(0.1,0.9)
vp.ref <- c("raw data"...
2006 Feb 10
1
?bquote
?bquote says it returns an expression but, in fact, it typically
(though not always) returns a call object:
> class(bquote(a+b))
[1] "call"
> class(bquote(1))
[1] "numeric"
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
...#39;s the code:
###Set mu and sigma at your pleasure:
mu <- 10.03
sigma <- 12.5786786
myx <- seq( mu - 3.5*sigma, mu+ 3.5*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# It is challenging to combine plotmath with values of mu and sigma in
one expression.
# Either bquote or substitute can be used. First use bquote:
myTitle1 <- bquote (paste("x ~ Normal(", mu== .(round(mu,2)), ',',
sigma== .(round(sigma,2)),")") )
### Using substitute:
### myTitle1 <- substitute( "x ~ Normal" ~~ group( "(", list(mu==mu1,
sigm...
2009 Nov 20
1
How to concatenate expressions
...ppreciate any help with the following example code.
Thank you
testplot <- function(a,b,c) {
text <- as.expression(paste(a,b,c,sep=' '))
dev.new()
plot(-5:5,-5:5,col=0)
for (i in 1:3) {
text(x=i,
y=i,
labels=text[i])
}
}
a <- as.expression(c(bquote(alpha),bquote(beta),bquote(gamma)))
b <- as.expression(1:3)
c <- as.expression(c(bquote('-10'^th),
bquote('-20'^th),
bquote('-30'^th)))
testplot(a,b,c)
2020 Mar 17
3
new bquote feature splice does not address a common LISP @ use case?
Dear R-devel,
There is a new feature in R-devel, which explicitly refers to LISP @
operator for splicing.
> The backquote function bquote() has a new argument splice to enable splicing a computed list of values into an expression, like ,@ in LISP's backquote.
Although the most upvoted SO question asking for exactly LISP's @
functionality in R doesn't seems to be addressed by this new feature.
Is it possible to use new s...
2006 Jul 25
5
greek letters, text, and values in labels
...ing like:
"Results for \theta=2.1", given that I have a variable theta=2.1, and
\theta should show on the screen like the greek letter.
I've tried a lot of things:
theta <- 2.1
plot(1:10, main=expression(paste("Results for", theta, "=", eval(theta))))
or using bquote
plot(1:10, main=paste("Results for ", bquote(theta == .(theta))))
or using substitute, etc. I could not make it work. This should be easy.
I would appreciate your help.
Thanks,
Adrian
2013 Jan 04
1
Using bquote to create names a for a list
Hello,
How would i use bquote to create names for a list.
e.g. to create list(a=10)
bquote(list(.(X)=10), list(X="a"))
does not work.
The best i could come up with is
bquote({ a=list(10);names(a)=.(X); a}, list(X="a"))
which is quite ugly.
Is there an elegant way to solve this?
Regards
Saptarshi
[...
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
Hello,
I upgraded from 3.1.2 to 3.2.1 and am receiving errors on code that worked
as I intended previously. Briefly, I am using bquote to generate
expressions to modify data.table objects within a function, so I need the
changes to actually be stored in the given environment. Previously, I used
code like the following:
test <- list(bquote(x <- 10))
fenv <- environment()
rapply(test, evalq, envir = fenv)
Although the co...
2011 Jun 23
1
Saved EPS does not match screen when using bquote(.(i))
Here's a fairly minimal-case example in which the saved EPS does not match
the screen. The error comes when using bquote(.(i)) instead of bquote(1), as
demonstrated by the two minimally different cases below. Very strange. Any
clues as to why?
#---------------- begin -------------------
# Version A. X axis labels have subscripts as constants. EPS is correct.
windows()
layout( matrix( 1:2 , nrow=2 ) )
plot( 0 , 0 ,...
2009 Aug 12
2
Using bold font with bquote
I'm trying to annotate a density plot and I'm using bquote to paste the sigma symbol next
to the numeric text of the standard deviation calculation that I am performing.
I have been able to successfully turn the sigma symbol and numeric output the color blue,
but when I try to change the font of the text to bold, R doesn't seem to recognize the "f...
2020 Mar 17
0
new bquote feature splice does not address a common LISP @ use case?
...seems this would make splicing easier to use
for end users, but make the metaprogramming model more complex for
experts. This is an interesting perspective though. It also seems
vaguely connected to the problem of splicing within model formulas.
I see in your example that the new ..() operator in `bquote()` allows
splicing calls, and seems to unquote them instead of splicing. In the
first versions of rlang, splicing with !!! behaved just like this. We
changed this behaviour last year and I would like to share the
motivations behind this decision, as it might be helpful to inform the
semantics of .....
2008 Jan 25
2
Using bquote: question
Hi all
Observe:
x <- c(1,2)
y <- c(1,-1)
phi <- 1
p <- 2
par( mfrow=c(1,2))
plot(x , y, main=bquote( paste( p==.(p)," and ",phi==.(phi)) ) )
plot(y ~ x, main=bquote( paste( p==.(p)," and ",phi==.(phi)) ) )
par( mfrow=c(1,2))
On my system (details below), the first plot is correct (in my
understanding), and produces a title reading "p=2 and phi=1" (with
appropriat...
2012 Oct 11
4
characters, mathematical expressions and computed values
Hello,
I have to add "Age (bar(x)=14.3) as a title on a chart. I am unable to get
this to working. I have tried bquote, substitute and expression, but they
are only doing a part of the job.
new<-
c(14.3, 18.5, 18.1, 17.7, 18, 15.9, 19.6, 17.3, 17.8, 17.5, 15.4,
16.3, 15, 17.1, 17.1, 16.4, 15.2, 16.7, 16.7, 16.9, 14.5, 16.6,
15.8, 15.2, 16.2, 15.6, 15, 17.1, 16.7, 15.6, 15, 15.8, 16.8,
17, 15.2, 15.8, 15.7, 1...
2006 Nov 14
3
Plot title with numeric variables
I am trying to create a plot title in R with substitution by a numeric
variable (Figure number N) within the text which is bold and has a
subcripted part as well. Here is what I have:
title <- expression(bold(paste("Figure ", N, ": Plot ", C[max], " versus
CrCL")))
plot(1, main="") # Simple plot for testing
N <- 5
mtext(title, line=3, font=2,