Displaying 20 results from an estimated 5000 matches similar to: "Coping with non-standard evaluation in R program analysis"
2018 Jan 04
0
Coping with non-standard evaluation in R program analysis
Hi Evan,
You may find some parts of what we are doing with genthat useful. Genthat is a tool
for creating unit tests by recording argument and return values of calls. This is
done by instrumentation of the source code.
The git repo with the code is here https://github.com/PRL-PRG/genthat
We don?t really deal with NSE though. It could be something worth thinking about for us.
The contact for
2018 Jan 03
3
Coping with non-standard evaluation in R program analysis
Hello R experts,
I plan to develop a tool for dynamic analysis of R programs. I would like to trace function calls at runtime, capturing argument and return values. Following a suggestion made some time ago on this list, my high-level implementation strategy is to rewrite the AST, augmenting call expressions with pre-call and post-call shims to capture the arguments and return value,
2017 Jul 31
0
force promises inside lapply
quote(expr) will make no changes in expr, it just returns its one argument,
unevaluated.
substitute could be used in your lapply(..., library) example to give
library a name instead
of a character string for an input (which might be necessary if the
character.only argument
were not available)
lapply(c("MASS", "splines"), function(pkg)
eval(substitute(library(pkg),
2017 Mar 19
0
RFC: (in-principle) native unquoting for standard evaluation
On Mon, Mar 20, 2017 at 7:36 AM, Radford Neal <radford at cs.toronto.edu> wrote:
> Michael Lawrence (as last in long series of posters)...
>
>> Yes, it would bind the language object to the environment, like an
>> R-level promise (but "promise" of course refers specifically to just
>> _lazy_ evaluation).
>>
>> For the uqs() thing, expanding calls
2017 Mar 19
0
RFC: (in-principle) native unquoting for standard evaluation
Yes, it would bind the language object to the environment, like an
R-level promise (but "promise" of course refers specifically to just
_lazy_ evaluation).
For the uqs() thing, expanding calls like that is somewhat orthogonal
to NSE. It would be nice in general to be able to write something like
mean(x, extra_args...) without resorting to do.call(mean, c(list(x),
extra_args)). If we had
2017 Mar 17
2
RFC: (in-principle) native unquoting for standard evaluation
I love the pointer analogy. Presumably the additional complication of scope
breaks this however. * itself would have been a nice operator for this were
it not prone to ambiguity (`a * *b` vs `a**b`, from which @ does not
suffer).
Would this extension require that function authors explicitly enable
auto-quoting support? I somewhat envisioned functions seeing the resolved
unquoted object (within
2017 Mar 17
0
RFC: (in-principle) native unquoting for standard evaluation
Interesting idea. Lazy and non-standard evaluation is going to happen; the
language needs a way to contain it.
I'll extend the proposal so that prefixing a formal argument with @ in
function() marks the argument as auto-quoting, so it arrives as a language
object without use of substitute(). Kind of like how '*' in C declares a
pointer and dereferences one.
subset <- function(x,
2017 Mar 19
3
RFC: (in-principle) native unquoting for standard evaluation
Michael Lawrence (as last in long series of posters)...
> Yes, it would bind the language object to the environment, like an
> R-level promise (but "promise" of course refers specifically to just
> _lazy_ evaluation).
>
> For the uqs() thing, expanding calls like that is somewhat orthogonal
> to NSE. It would be nice in general to be able to write something like
>
2017 Mar 17
4
RFC: (in-principle) native unquoting for standard evaluation
(please be gentle, it's my first time)
I am interested in discussions (possibly reiterating past threads --
searching didn't turn up much) on the possibility of supporting standard
evaluation unquoting at the language level. This has been brought up in a
recent similar thread here [1] and on Twitter [2] where I proposed the
following desired (in-principle) syntax
f <-
2017 Mar 19
3
RFC: (in-principle) native unquoting for standard evaluation
Would this return a quosure? (i.e. a single sided formula that captures
both expression and environment). That's the data structure we've adopted
in tidyeval as it already has some built in support.
Hadley
On Friday, March 17, 2017, Michael Lawrence <lawrence.michael at gene.com>
wrote:
> Interesting idea. Lazy and non-standard evaluation is going to happen; the
> language
2020 Mar 27
1
object.size vs lobstr::obj_size
On 3/27/20 15:19, Hadley Wickham wrote:
>
>
> On Fri, Mar 27, 2020 at 4:01 PM Herv? Pag?s <hpages at fredhutch.org
> <mailto:hpages at fredhutch.org>> wrote:
>
>
>
> On 3/27/20 12:00, Hadley Wickham wrote:
> >
> >
> > On Fri, Mar 27, 2020 at 10:39 AM Herv? Pag?s
> <hpages at fredhutch.org <mailto:hpages at
2018 May 30
2
Evaluation failure of IAPWS95 functions in a rowwise manner (tidyverse style)
I'm trying to use the IAPWS95 package with the tidyverse packages. For some reason, the function is not outputting the correct rho.
A minimal example with results is below. I've also included the definition of the DTp function from the IAPWS95 library.
====================================
library(IAPWS95)
library(tidyverse)
initial <- data.frame(T=c(279,294),p=c(0.46,0.46))
2018 May 30
0
Evaluation failure of IAPWS95 functions in a rowwise manner (tidyverse style)
Hi Shawn,
I don't think it has anything to do with the tidyverse. If you keep
simplifying your example you'll get all the way down to
> DTp(T=c(279,294),p=c(0.46,0.46))
[1] 1000.12283
--Ista
On Wed, May 30, 2018 at 2:14 PM, Shawn Way <SWay at meco.com> wrote:
> I'm trying to use the IAPWS95 package with the tidyverse packages. For some reason, the function is not
2017 Nov 02
0
Memory address of character datatype
If you were curious about the hidden details of the memory layout in R,
the best reference is the source code. In your example, you are not
getting to your string because there is one more pointer in the way, "x"
is a vector of strings, each string is represented by a pointer.
At C level, there is an API for getting an address of the value, e.g.
INTEGER(x) or CHAR(STRING_ELT(x)).
At
2020 Mar 27
0
object.size vs lobstr::obj_size
On Fri, Mar 27, 2020 at 4:01 PM Herv? Pag?s <hpages at fredhutch.org> wrote:
>
>
> On 3/27/20 12:00, Hadley Wickham wrote:
> >
> >
> > On Fri, Mar 27, 2020 at 10:39 AM Herv? Pag?s <hpages at fredhutch.org
> > <mailto:hpages at fredhutch.org>> wrote:
> >
> > Hi Tomas,
> >
> > On 3/27/20 07:01, Tomas Kalibera wrote:
2017 Nov 12
1
Array changing address unexpectedly
Hi David,
?
Thanks for the correction concerning the "else" issue.
?
Taking your code and removing some lines (to increase readability):
?
library(pryr)
?
data <- array(dim = c(5))
for(x in 1:5)
{
?? data[x] <- as.integer(x * 2)
}
?
#print(data)
?
add = address(data)
for(x in 1:5)
{
?? data[x] <- as.integer(0)
}
?
if (add == address(data))
{
print("Address did not
2017 Nov 01
2
Memory address of character datatype
Hi,
?
To get the memory address of where the value of variable "x" (of datatype "numeric") is stored one does the following in R (in 32 bit):
?
??? ? library(pryr)
? ?? ?x <- 1024
?? ?? addr <- as.numeric(address(x)) +?24?? ?# 24 is needed to jump the variable info and point to the data itself (i.e. 1024)
?
The question now is what is the value of the jump?so that one
2018 May 13
1
different type of modification when code is sourced and pasted
Dear all,
I have a question about R's modification in place and replacement functions.
I was working through Hadley Wickham's Advanced R section on
Replacement Functions and
in a file (say test.R) I wrote:
`second<-` <- function(x, value) {
x[2] <- value
x
}
x <- 1:10
second(x) <- 5L
print(x)
library(pryr)
x <- 1:10
print(address(x))
second(x) <- 6L
2017 Nov 12
0
Array changing address unexpectedly
> On Nov 12, 2017, at 8:47 AM, lille stor <lille.stor at gmx.com> wrote:
>
> Hi,
>
> Given the following R code:
>
> library(pryr)
>
> data <- array(dim = c(5))
>
> for(x in 1:5)
> {
> data[x] <- as.integer(x * 2)
> }
>
> add = address(data) # save address of "data"
>
> for(x in
2010 Jun 05
1
How to get the closing price from the the GOOGLE FINANCE site for NSEINDIA stocks
Sir,
How to get the closing price from this link
http://www.google.com/finance/historical?q=NSE:RCOM
I installed quantmod
getSymbols('NSE:RCOM',src='google')
gives me this error**********************
Error in download.file(paste(google.URL, "q=", Symbols.name, "&startdate=", :
cannot open URL