Skip to content

Evaluate aes() in calling environment. Fixes #743 #744

Closed
wants to merge 2 commits into from

4 participants

@wch
Collaborator
wch commented Dec 20, 2012

This fixes #743.

@hadley
Owner
hadley commented Jan 3, 2013

Does this also fix #248?

@wch
Collaborator
wch commented Jan 3, 2013

It partially fixes #248. Each aes() is evaluated in the scope of the ggplot call, not in the scope where each aes() is called.

@antoine-lizee

It doesn't seem that it is fixed. If I run the code below...
I may have forgot something, but this is very sad because it makes it difficult to use ggplot2 in a function!

s1 <- 2

test <- function(){
   s1 <- 4
   TEST <- data.frame(num=c(1,2,3,4), name=c("a","b","c","d"))
   print(with(TEST, num/s1))
   print(qplot(data = TEST, x=name, y=num/s1))
   print(ggplot(data = TEST) + geom_bar( aes(x=name, y=num/s1) , stat= 'identity'))
}
@hadley
Owner
hadley commented Feb 24, 2014

Could you please rebase/merge against master, re-document with the development version of roxygen2 (install_github("klutometis/roxygen) and resubmit?

@hadley hadley closed this Feb 24, 2014
@tsibley
tsibley commented Jul 1, 2014

@hadley In the interest of seeing this merged, I rebased and re-documented as PR #982.

@hadley hadley added a commit that referenced this pull request Jun 11, 2015
@hadley Add test for aes eval environment. Closes #744 399ec2d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.