Skip to content

Commit c6918fe

Browse files
committed
Refer to rq by name
1 parent 9b4c6ae commit c6918fe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/stat-quantile.r

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ StatQuantile <- proto(Stat, {
1616
default_aes <- function(.) aes(group = ..quantile..)
1717
required_aes <- c("x", "y")
1818

19-
calculate <- function(., data, scales, quantiles=c(0.25, 0.5, 0.75), formula=y ~ x, xseq = NULL, method=rq, na.rm = FALSE, ...) {
19+
calculate <- function(., data, scales, quantiles=c(0.25, 0.5, 0.75), formula=y ~ x, xseq = NULL, method="rq", na.rm = FALSE, ...) {
2020
try_require("quantreg")
2121
if (is.null(data$weight)) data$weight <- 1
2222

2323
if (is.null(xseq)) xseq <- seq(min(data$x, na.rm=TRUE), max(data$x, na.rm=TRUE), length=100)
2424

2525
data <- as.data.frame(data)
2626
data <- remove_missing(data, na.rm, c("x", "y"), name = "stat_quantile")
27+
28+
method <- match.fun(method)
2729
model <- method(formula, data=data, tau=quantiles, weight=weight, ...)
2830

2931
yhats <- stats::predict(model, data.frame(x=xseq), type="matrix")

0 commit comments

Comments
 (0)