Skip to content

Commit

Permalink
Add as.data.frame method to mapped_discrete that strips the class so …
Browse files Browse the repository at this point in the history
…that recycling is possible
  • Loading branch information
thomasp85 committed May 28, 2020
1 parent f802c5e commit 1f1e785
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -13,3 +13,4 @@ revdep/library
revdep/checks.noindex
revdep/library.noindex
revdep/data.sqlite
revdep/cloud.noindex
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -11,6 +11,7 @@ S3method("[<-",uneval)
S3method("[[",ggproto)
S3method("[[<-",uneval)
S3method(.DollarNames,ggproto)
S3method(as.data.frame,mapped_discrete)
S3method(as.list,ggproto)
S3method(autolayer,default)
S3method(autoplot,default)
Expand Down
4 changes: 4 additions & 0 deletions R/scale-discrete-.r
Expand Up @@ -157,3 +157,7 @@ c.mapped_discrete <- function(..., recursive = FALSE) {
value <- as.numeric(unclass(value))
new_mapped_discrete(NextMethod())
}
#' @export
as.data.frame.mapped_discrete <- function (x, ..., stringsAsFactors = default.stringsAsFactors()) {
as.data.frame.vector(x = unclass(x), ..., stringsAsFactors = stringsAsFactors)
}

0 comments on commit 1f1e785

Please sign in to comment.