similar to: Inspect a "delayed" assigned whose value throws an error?

Displaying 20 results from an estimated 500 matches similar to: "Inspect a "delayed" assigned whose value throws an error?"

2015 Jan 26
2
Inspect a "delayed" assigned whose value throws an error?
On Mon, Jan 26, 2015 at 12:24 PM, Hadley Wickham <h.wickham at gmail.com> wrote: > If it was any other environment than the global, you could use substitute: > > e <- new.env() > delayedAssign("foo", stop("Hey!"), assign.env = e) > substitute(foo, e) > > delayedAssign("foo", stop("Hey!")) > substitute(foo) Hmm... interesting
2015 Jan 26
0
Inspect a "delayed" assigned whose value throws an error?
If it was any other environment than the global, you could use substitute: e <- new.env() delayedAssign("foo", stop("Hey!"), assign.env = e) substitute(foo, e) delayedAssign("foo", stop("Hey!")) substitute(foo) Hadley On Mon, Jan 26, 2015 at 12:53 PM, Henrik Bengtsson <hb at biostat.ucsf.edu> wrote: > Hi, I got an interesting programming
2015 Jan 27
0
Inspect a "delayed" assigned whose value throws an error?
>>>>> Henrik Bengtsson <hb at biostat.ucsf.edu> >>>>> on Mon, 26 Jan 2015 12:41:48 -0800 writes: > On Mon, Jan 26, 2015 at 12:24 PM, Hadley Wickham <h.wickham at gmail.com> wrote: >> If it was any other environment than the global, you could use substitute: >> >> e <- new.env() >>
2011 Mar 30
2
R CMD build now removes empty dirs
Hi, It's unfortunate that with recent revisions of R 2.13 (this appeared in revision 54640, March 2), 'R CMD build' now removes empty dirs in the package. People might have good reasons for having empty dirs in their packages. For example, in Bioconductor, we have some tools to automatically generate annotation packages and those tools are implemented in software packages that use
2008 Dec 11
3
DO NOT REPLY [Bug 5963] New: rsync fails with errors that make no sense...
https://bugzilla.samba.org/show_bug.cgi?id=5963 Summary: rsync fails with errors that make no sense... Product: rsync Version: 3.0.4 Platform: x86 OS/Version: Linux Status: NEW Severity: major Priority: P3 Component: core AssignedTo: wayned@samba.org ReportedBy: crhea@mayo.edu
2007 Jun 25
3
a string to enviroment or function
Hi, I am wondering how to make a function Fun to make the following work: t0 <- (paste("hgu133a", "ENTREZID", sep="")) xx <- as.list(Fun(t0)) # make it work like xx<-as.list(hgu133aENTREZID) thanks, -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III
2010 Jan 29
1
combine 3 affybatches
Hello, Im trying to combine 3 affybatches (1x hgu133+2 array and 2x hgu133a array) Im useing this script: library(matchprobes) library(affy) library(AnnotationDbi) library(hgu133plus2probe) library(hgu133aprobe) library(hgu133a.db) u133p2 = ReadAffy() # reading hgu133 +2 cel file into affybatch u133a1 = ReadAffy() # reading hgu133a cel file into affybatch u133a2 = ReadAffy() # reading hgu133a
2012 Apr 25
4
delayedAssign changing values
I'm not sure if this is a known peculiarity or a bug, but I stumbled across what I think is very odd behavior from delayedAssign. In the below example x switches values the first two times it is evaluated. > delayedAssign("x", {x <- 2; x+3}) > x==x [1] FALSE > delayedAssign("x", {x <- 2; x+3}) > x [1] 5 > x [1] 2 The ?delayedAssign documentation says
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
2011 May 02
2
Using substitute to access the expression related to a promise
Hi all, The help for delayedAssign suggests that you can use substitute to access the expression associated with a promise, and the help for substitute says: "If it is a promise object, i.e., a formal argument to a function or explicitly created using ?delayedAssign()?, the expression slot of the promise replaces the symbol. But this doesn't seem to work: > a <- 1 > b <- 2
2012 Apr 29
1
A doubt about substitute() after delayedAssign()
Hello, ?delayedAssign presents substitute() as a way to look at the expression in the promise. However, msg <- "old" delayedAssign("x", msg) msg <- "new!" x #- new! substitute(x) #- x (was 'msg' ?) Here, we just got 'x'... shouldn't we got 'msg'? Same result when the promise is not evaluated yet: delayedAssign("x",
2007 Feb 13
1
question on docs for delayedAssign and substitute
The help files for delayedAssign and substitute both say that substitute() can be used to see the expression associated with a promise. However, I can't see how to do that. When I try the example in help file for delayedAssign I don't see substitute() extracting the promise, e.g.: > msg <- "old" > delayedAssign("x", msg) > msg <-
2006 May 19
2
delayedAssign and interrupts
I noticed something recently that I thought was odd: delayedAssign("x", { Sys.sleep(5); 1 }) x ## Hit Ctrl-C within the first second or 2 gives me: > delayedAssign("x", { Sys.sleep(5); 1 }) > x ## Hit Ctrl-C within the first second or two > x Error: recursive default argument reference > My only problem here is that now I'm stuck---there's no way
2012 Jan 30
4
replacing characters in matrix. substitute, delayedAssign, huh?
A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names. So that has to be a character matrix. Consider: > BM <- matrix("0.1", 5, 5) Use data.entry(BM) or similar to set some to more abstract values. > BM[3,1] <- "a" > BM[4,2] <- "b" >
2011 Apr 08
1
R and lazy evaluation
Haskell is the prototypical lazy evaluation language. One can compute a Fibonacci sequence by the Haaskell equivalent of the following R code. > fibs <- c(0, 1, rep(0, 8)) > fibs[3:10] <- fibs + fibs[-1] This works as follows. fibs = 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 fibs = 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 When one adds fibs to fibs[-1], one is effectively adding diagonally: fibs[3] <-
2005 Mar 11
3
delay() has been deprecated for 2.1.0
After a bunch of discussion in the core group, we have decided to deprecate the delay() function (which was introduced as "experimental" in R 0.50). This is the function that duplicates in R code the delayed evaluation mechanism (the promise) that's used in evaluating function arguments. The problem with delay() was that it was handled inconsistently (e.g. sometimes you would see
2007 Sep 19
3
delayedAssign
The last two lines of example(delayedAssign) give this: > e <- (function(x, y = 1, z) environment())(1+2, "y", {cat(" HO! "); pi+2}) > (le <- as.list(e)) # evaluates the promises $x <promise: 0x032b31f8> $y <promise: 0x032b3230> $z <promise: 0x032b3268> which contrary to the comment appears unevaluated. Is the comment wrong or is it supposed to
2013 Apr 03
1
Documentation error in subsitute
Hi all, The documentation for substitute currently reads: Substitution takes place by examining each component of the parse tree as follows: If it is not a bound symbol in ?env?, it is unchanged. If it is a promise object, i.e., a formal argument to a function or explicitly created using ?delayedAssign()?, the expression slot of the promise replaces the symbol. If it is an ordinary variable,
2006 Oct 18
1
Error condition in evaluating a promise
Is there a way to raise an error condition when a promise is evaluated such that is can be evaluated again? Right now strange things happen when the evaluation fails: > delayedAssign("x", if (failed) stop("you have to initialize me first!") else foo) > foo <- "I'm foo" > failed<-TRUE > x Error: you have to initialize me first! > x
2024 Feb 17
2
Capturing Function Arguments
I'm wrapping a function in R and I want to record all the arguments passed to it, including default values and missing values. I want to be able to snoop on function calls in sourced scripts as part of a unit testing framework. I can capture the values fine, but I'm having trouble evaluating them as if `force()` had been applied to each of them. Here is a minimal example: f0 <-