You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(rstatic)
node0 = quote_ast({
x = data.frame(a = 1:10, b = letters[1:10])
x$c = rnorm(10)
sum(x$a)
head(x)
})
# We can evaluate this.
eval(to_r(node0))
# Seems to go from a brace to a function
node = to_cfg(node0)
nr = to_r(node)
f = eval(nr)
# But we can't evaluate it here.
f()
Some relevant output:
> f()
Error in x_2$c = rnorm(10) : object 'x_2' not found
> f
function ()
{
x_1 = data.frame(a = 1:10, b = letters[1:10])
x_2$c = rnorm(10)
sum(x_2$a)
return(head(x_2))
}
It seems we need to add the line x_2 = x_1.
The text was updated successfully, but these errors were encountered:
How can the following code be converted to SSA?
Some relevant output:
It seems we need to add the line
x_2 = x_1
.The text was updated successfully, but these errors were encountered: