Displaying 20 results from an estimated 60000 matches similar to: "unevaluated expression"
2010 Mar 02
2
turn character string into unevaluated R object
Hi,
How to turn a character string into an unevaluated R object? I want to load some files in a directory into data matrix R objects. I could do this with read.table and assign (see below). Then, I want to turn the character string representing a file name (the evaluated expression of i) into an unevaluated R object. Basically, I want to create matrices whose names are the same as the related file
2010 Oct 18
1
paste an unevaluated expression
Hi R-users,
I would like to create an expression without evaluating it. Then paste
that expression to an object. Example:
Result <- paste('Result', 1, sep="")
paste(Result, substitute(apply(exp.des[1:10,], 1, one.row,
parms=parameters)), sep="<-")
However this pastes EACH element of the unevaluated expression. Instead
I just would like the expression
2005 Oct 13
1
Getting ... as an unevaluated list
Hi,
I'm trying to get ...as a list of unevaluated arguments, ie.
substitute(list(...)) gives me an unevaluated list of the arguments,
but I want a list of the unevaluated arguments.
My attempts so far:
(function(...) substitute(...))(a=1, b=a) # Only returns first
(function(...) substitute(list(...)))(a=1, b=a) # Unevaluated list,
not list of unevaluated
(function(...)
2007 Mar 20
2
run a script during R CMD build
I would like R CMD build to run some R code which does some stuff and save the result as a file in /inst/docs folder.
Is there any way of doing this.
Thank you.
Johan
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
[[alternative HTML version deleted]]
2009 Dec 01
1
Adding and Multiplying two Unevaluated Expressions
HI,
As I'm trying to compute Taylor series, I'm having problems in adding and multiplying unevaluated expressions. I searched for a solution but found none.
my Taylor function works fine for evaluating functions as you can see here:
rTaylorVal=function(exp,x0,dx,n) {
ls=list(x=x0)
newexp=eval(exp,ls)
exp0=exp
for (i in 1:n){
exp0=D(exp0,"x")
2006 Jul 24
1
deparse - width.cutoff
I have a question about "deparse" function in R
What is the reason that "deparse" use an argument like "width.cutoff" ?
Why the maximum cutoff is 500?
I was manipulating an R formula and used "deparse". Since the length of user's formula was greater then 500, my code didnt work.
thanks
Johan
johan Faux <johanfaux@yahoo.com> wrote: I have a
2007 Jun 04
2
locked environment and inheritance
Hi,
I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create
a S4 class which extends (adds 2 slots) another S4 class from some other package. The class
should be created in "myPkg" environment (and not global environment).
Using:
setClass("myS4class", representation("otherS4class", mydata = "numeric"),
2007 Jan 30
3
silent loading of packages
I would like to turn off all the messages during
library(aPackage) or
require(aPackage)
I tried different commands: invisible, capture.output, sink but none of them is working.
For example, loading VGAM, gives a lot of unnecessary messages:
> library(VGAM)
Attaching package: 'VGAM'
The following object(s) are masked from package:splines :
bs
The
2009 Aug 02
1
Last expression entered by user
Hi,
I am looking for a way to find out the last expression that was
entered by the user, similar to ".Last.value", but for the unevaluated
expression instead of the evaluated one.
Example:
> x <- 4
> x*x + 3
[1] 19
> .Last.value # that's the evaluated last expression
[1] 19
# but I am looking for the unevaluated expression (".Last.expression",
so to
2006 Jan 13
2
for loop should check the looping index !!
Hello ,
a<-c(1)
for(i in 2:length(a))
do.something with a[[i]]
I get :
Error in a[[i]] : subscript out of bounds
Am I missing something here? Doesnt R check the value of i inside "for" and if the condition is not tru, dont do anything ????
thanks,
johan
---------------------------------
Got holiday prints? See all the ways to get quality
2014 May 01
3
How to test if an object/argument is "parse tree" - without evaluating it?
This may have been asked before, but is there an elegant way to check
whether an variable/argument passed to a function is a "parse tree"
for an (unevaluated) expression or not, *without* evaluating it if
not?
Currently, I do various rather ad hoc eval()+substitute() tricks for
this that most likely only work under certain circumstances. Ideally,
I'm looking for a isParseTree()
2009 Dec 02
0
[Fwd: Re: Adding and Multiplying two Unevaluated Expressions]
-------- Original-Nachricht --------
Betreff: Re: [R] Adding and Multiplying two Unevaluated Expressions
Datum: Tue, 01 Dec 2009 23:49:39 +0100
Von: Benjamin M?ller <ben_mueller.bm at web.de>
An: Rolf Turner <r.turner at auckland.ac.nz>
Referenzen: <20091201144125.316310 at gmx.net>
<8E40E49F-E8FC-4FBD-8CC5-93789FFB0E53 at auckland.ac.nz>
This works fine for your
2009 Jan 09
3
Firefox 3 and HTML Search
I finally upgraded to Firefox 3.05 from 2.x, and now I can reproduce a
bug a colleague has been complaining about but which I hadn't been able
to reproduce before. In Windows, set Firefox as the default browser.
Then in Rgui (seems to affect all versions up to R-devel), use the menu
to open HTML Help, and choose "Search Engine and Keywords".
Enter a keyword (e.g. plot), and
2018 Aug 13
2
substitute() on arguments in ellipsis ("dot dot dot")?
Interestingly,
as.list(substitute(...()))
also works.
On Sun, Aug 12, 2018 at 1:16 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 12/08/2018 4:00 PM, Henrik Bengtsson wrote:
>>
>> Hi. For any number of *known* arguments, we can do:
>>
>> one <- function(a) list(a = substitute(a))
>> two <- function(a, b) list(a = substitute(a), b =
2013 May 16
3
Substitute / delayedAssign (was: Substitute unaware when promise objects are evaluated)
Duncan, Thank you for the clarification on how delayedAssign works. Should R-level interfaces to promise objects ever become available, I expect they would at time come in handy.
On the subject of substitute and delayedAssign, I do have a follow-up question for the list. I'm trying to convert a named list of expression objects into an environment of promise objects. After conversion, each
2007 Mar 13
2
Sweave question: prevent expansion of unevaluated reused code chunk
Hi,
Consider the following (much simplified) Sweave example:
--------------
First, we set the value of $x$:
<<chunk1,eval=FALSE>>=
x <- 1
@
Then we set the value of $y$:
<<chunk2,eval=FALSE>>=
y <- 2
@
Thus, the overall algorithm has this structure:
<<combined,eval=FALSE>>=
<<chunk1>>
<<chunk2>>
@
2012 Jul 24
1
Convenience function to get unevaluated ... function arguments
Folks:
Herein is a suggestion for a little R convenience function mainly to
obtain unevaluated ... function arguments. It arose from a query on
R-help on how to get these arguments. The standard (I think) idiom to
do this is via
match.call(expand.dots=FALSE)$...
However, Bill Dunlap pointed out that this repeats the argument
matching of the function call and suggested a couple of alternatives
2001 Apr 30
2
plotting an expression
I am sure it is just me not understanding how R works, but could somebody
explain why
curve(cos(x))
works and
curve(expression(cos(x))
does not?
I have done some investigating and here is what I found. If I comment out
the line of curve indicated below, both calls work fine.
function (expr, from, to, n = 101, add = FALSE, type = "l", ylab = NULL,
log = NULL, xlim =
2010 Dec 18
1
how to use expression as function arguements?
Hi all,
#####################################
integ=function(f,n){
# computes vector y = f(x)
x=runif(10000)
y=f
hatI=mean(y)
hatI
}
# example of use
integ(x^2+x+100,100)
#####################################
it returns an error says no obj 'x'
how do I 'tell' R to treat 'f' as an input expression?
Thanks.
casper
--
View this message in context:
2013 May 15
1
Substitute unaware when promise objects are evaluated
R-devel,
I used the 'substitute' function to create labels for objects inside an environment, without actually evaluating the objects, as the objects might be promises.
However, I was surprised to see that 'substitute' returns the expression slot of the original promise even after the promise has been forcibly evaluated. (Doesn't the promise go away after evaluation?) This