Skip to content

Commit aa1e2c2

Browse files
authored
Merge pull request #10 from jaredlander/fix/aes_string
Removing aes_string usage
2 parents aafee13 + a50c300 commit aa1e2c2

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

R/hartigan.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ PlotHartigan <- function(hartigan, title="Hartigan's Rule", smooth=FALSE, lineco
4646
thePlot <- ggplot(data=hartigan, aes(x=.data[['Clusters']], y=.data[['Hartigan']])) +
4747
geom_hline(aes(yintercept=10), linetype=linetype, colour=linecolor, linewidth=linesize) +
4848
#geom_line() +
49-
geom_point(aes_string(colour="AddCluster")) +
49+
geom_point(aes(colour=.data[['AddCluster']])) +
5050
scale_colour_discrete(name="Add Cluster") +
5151
ggtitle(label=title) + if(minor) scale_x_continuous(minor_breaks=(1:(max(hartigan$Clusters)+1)))
5252

R/kmeansPlotting.r

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ fortify.kmeans <- function(model, data=NULL, ...)
7878
#' k1 <- kmeans(x=iris[, 1:4], centers=3)
7979
#' plot(k1)
8080
#' plot(k1, data=iris)
81+
#' plot(k1, data=iris, class=Species)
8182
#'
8283
plot.kmeans <-
8384
function(x, data=NULL, class=NULL, size=2,
@@ -94,8 +95,9 @@ plot.kmeans <-
9495
# convert class to factor just in case it is not already
9596
if(!is.null(class)) toPlot[, class] <- factor(toPlot[, class])
9697

97-
ggplot(toPlot, aes_string(x='.x', y='.y', colour='.Cluster')) +
98-
geom_point(aes_string(shape=class), size=size) +
98+
ggplot(toPlot, aes(x=.data[['.x']], y=.data[['.y']], colour=.data[['.Cluster']])) +
99+
# geom_point(aes_string(shape='class'), size=size) +
100+
geom_point(aes(shape={{class}}), size=size) +
99101
scale_color_discrete("Cluster") +
100102
theme(legend.position=legend.position) +
101103
labs(title=title, x=xlab, y=ylab)

R/tsPlot.r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ ts.plotter <- function(data, time=NULL,
9595
y <- names(data)[2]
9696

9797
# build the plot
98-
ggplot(data, aes_string(x=x, y=y)) + geom_line(aes(group=1)) +
98+
ggplot(data, aes(x=.data[[x]], y=.data[[y]])) + geom_line(aes(group=1)) +
9999
labs(title=title, x=xlab, y=ylab)
100100
}
101101

@@ -177,8 +177,8 @@ autoplot.acf <- function(object,
177177
y <- names(data)[2]
178178

179179
# build plot
180-
ggplot(data, aes_string(x=x)) +
181-
geom_linerange(aes_string(ymin=pmin(y, 0), ymax=pmax(y, 0))) +
180+
ggplot(data, aes(x=.data[[x]])) +
181+
geom_linerange(aes(ymin=pmin(.data[[y]], 0), ymax=pmax(.data[[y]], 0))) +
182182
labs(title=title, x=xlab, y=ylab)
183183
}
184184

0 commit comments

Comments
 (0)