Skip to content

Commit 1f1e785

Browse files
committed
Add as.data.frame method to mapped_discrete that strips the class so that recycling is possible
1 parent f802c5e commit 1f1e785

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ revdep/library
1313
revdep/checks.noindex
1414
revdep/library.noindex
1515
revdep/data.sqlite
16+
revdep/cloud.noindex

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ S3method("[<-",uneval)
1111
S3method("[[",ggproto)
1212
S3method("[[<-",uneval)
1313
S3method(.DollarNames,ggproto)
14+
S3method(as.data.frame,mapped_discrete)
1415
S3method(as.list,ggproto)
1516
S3method(autolayer,default)
1617
S3method(autoplot,default)

R/scale-discrete-.r

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,7 @@ c.mapped_discrete <- function(..., recursive = FALSE) {
157157
value <- as.numeric(unclass(value))
158158
new_mapped_discrete(NextMethod())
159159
}
160+
#' @export
161+
as.data.frame.mapped_discrete <- function (x, ..., stringsAsFactors = default.stringsAsFactors()) {
162+
as.data.frame.vector(x = unclass(x), ..., stringsAsFactors = stringsAsFactors)
163+
}

0 commit comments

Comments
 (0)