similar to: Converting an unevaluted list to list of unevaluted elements

Displaying 20 results from an estimated 40000 matches similar to: "Converting an unevaluted list to list of unevaluted elements"

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(...)
2018 Aug 13
1
substitute() on arguments in ellipsis ("dot dot dot")?
Since you're already using bang-bang ;) library(rlang) dots1 <- function(...) as.list(substitute(list(...)))[-1L] dots2 <- function(...) as.list(substitute(...())) dots3 <- function(...) match.call(expand.dots = FALSE)[["..."]] dots4 <- function(...) exprs(...) bench::mark( dots1(1+2, "a", rnorm(3), stop("bang!")), dots2(1+2, "a",
2007 May 18
1
penalized maximum likelihood estimator
dear R-helper, I tried to find out a package in which i can have penalized maximum likelihood estimator applying on generalized extreme value distribution with beta function) but could not. would you please help me to know the name of the package. thanks for your help. S.Murshed --- r-help-request at stat.math.ethz.ch wrote: > Send R-help mailing list submissions to > r-help at
2018 May 03
0
Converting a list to a data frame
On Wed, May 2, 2018 at 11:53 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: > Another approach: > > ######## > library(tidyr) > L <- list( A = data.frame( x=1:2, y=3:4 ) > , B = data.frame( x=5:6, y=7:8 ) > ) > D <- data.frame( Type = names( L ) > , stringsAsFactors = FALSE > ) > D$data <- L
2013 Apr 22
1
Converting an environment to a list: mget vs. as.list
Hi all, An interesting discovery: if you want to convert an environment to a list, and you already know the names of the objects in the environment, using mget is about twice as fast as using as.list on the environment. https://gist.github.com/hadley/5434786 Hadley -- Chief Scientist, RStudio http://had.co.nz/
2006 Jul 07
4
Modifying parsed code
I would like to take this: .img(plot(1:10), filename="a") and produce plot(1:10) ie. whenever .img is used, I want to take the first argument and throw away everything else. (I am trying to produce a Sweave like environment in which I can apply certain functions, but not have them displayed in the output) I think I should be able to do it using substitute, but I don't know how
2012 Oct 08
4
Capturing environment associated with a promise
Hi all, It's possible to capture the expression associated with a promise (using substitute). Is there any way to capture the environment associated with a promise? Similarly, is there any way to tell if something is a promise without accidentally evaluating it? Thanks! Hadley -- RStudio / Rice University http://had.co.nz/
2015 Oct 07
2
authorship and citation
An example from the sos package: Its DESCRIPTION file says Author: Spencer Graves, Sundar Dorai-Raj, and Romain Francois. However, the package includes a findFn function, whose help file includes an Author(s) section, which reads, "Spencer Graves, Sundar Dorai-Raj, Romain Francois. Duncan Murdoch suggested the "???" alias for "findFn" and contributed the code for
2018 May 03
2
length of `...`
On Thu, May 3, 2018 at 9:50 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 03/05/2018 11:18 AM, Duncan Murdoch wrote: >> >> On 03/05/2018 11:01 AM, William Dunlap via R-devel wrote: >>> >>> In R-3.5.0 you can use ...length(): >>> > f <- function(..., n) ...length() >>> > f(stop("one"),
2006 Mar 08
0
survival
Dear R-helpers, We marked 6000 leaves from 5 SPECIES - 10 individuals/species - in two different TREATMENTs: a control and a dry-plot from which 50% of incoming precipitation was excluded. We followed those leaves for 42 months and noted the presence and absence at each visit. I then carried out a Cox Harzard model to see differences in leaf mortality between parcels and among species over time:
2018 May 04
0
length of `...`
>>>>> Herv? Pag?s <hpages at fredhutch.org> >>>>> on Thu, 3 May 2018 08:55:20 -0700 writes: > Hi, > It would be great if one of the experts could comment on the > difference between Hadley's dotlength and ...length? The fact > that someone bothered to implement a new primitive for that > when there seems to be a very
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
2018 May 02
3
Converting a list to a data frame
Another approach: ######## library(tidyr) L <- list( A = data.frame( x=1:2, y=3:4 ) , B = data.frame( x=5:6, y=7:8 ) ) D <- data.frame( Type = names( L ) , stringsAsFactors = FALSE ) D$data <- L unnest(D, data) #> Type x y #> 1 A 1 3 #> 2 A 2 4 #> 3 B 5 7 #> 4 B 6 8 ######## On Wed, 2 May 2018, Eivind K.
2017 Mar 17
0
Support for user defined unary functions
William, Unbeknownst to me when I sent this, Jonathon Carrol started a specific thread about unquoting and a proposal for supporting it at the language level, which I think is a better place to discuss unquoting specifically. That said, the basics as I understand them in the context of non-standard evaluation, unquoting (or perhaps interpolation) is essentially substituting part of an unevaluated
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
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
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 =
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
2018 May 04
1
length of `...`
The one difference I see, is the necessity to pass the dots to the function dotlength : dotlength <- function(...) nargs() myfun <- function(..., someArg = 1){ n1 <- ...length() n2 <- dotlength() n3 <- dotlength(...) return(c(n1, n2, n3)) } myfun(stop("A"), stop("B"), someArg = stop("c")) I don't really see immediately how one can
2018 May 03
3
length of `...`
Hi, It would be great if one of the experts could comment on the difference between Hadley's dotlength and ...length? The fact that someone bothered to implement a new primitive for that when there seems to be a very simple and straightforward R-only solution suggests that there might be some gotchas/pitfalls with the R-only solution. Thanks, H. On 05/03/2018 08:34 AM, Hadley Wickham