How can I handle R CMD check “no visible binding for global variable” notes when my ggplot2 syntax is sensible?

EDIT: Hadley Wickham points out that I misspoke. R CMD check is throwing NOTES, not Warnings. I’m terribly sorry for the confusion. It was my oversight. The short version R CMD check throws this note every time I use sensible plot-creation syntax in ggplot2: no visible binding for global variable [variable name] I understand why … Read more

How to assign colors to categorical variables in ggplot2 that have stable mapping?

I’ve been getting up to speed with R in the last month. Here is my question: What is a good way to assign colors to categorical variables in ggplot2 that have stable mapping? I need consistent colors across a set of graphs that have different subsets and different number of categorical variables. For example, plot1 … Read more

Label points in geom_point

The data I’m playing with comes from the internet source listed below nba <- read.csv(“http://datasets.flowingdata.com/ppg2008.csv”, sep=”,”) What I want to do, is create a 2D points graph comparing two metrics from this table, with each player representing a dot on the graph. I have the following code: nbaplot <- ggplot(nba, aes(x= MIN, y= PTS, colour=”green”, … Read more

ggplot2 line chart gives “geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?”

With this data frame (“df”): year pollution 1 1999 346.82000 2 2002 134.30882 3 2005 130.43038 4 2008 88.27546 I try to create a line chart like this: plot5 <- ggplot(df, aes(year, pollution)) + geom_point() + geom_line() + labs(x = “Year”, y = “Particulate matter emissions (tons)”, title = “Motor vehicle emissions in Baltimore”) The … Read more