소스 검색

Export print and is methods for anim_opts

And no need to filter out NULL elements
pkg-add-anim-opts-fixed
Garrick Aden-Buie 7 년 전
부모
커밋
bbb8410c78
2개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. +2
    -0
      NAMESPACE
  2. +8
    -7
      R/animate_options.R

+ 2
- 0
NAMESPACE 파일 보기

@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(print,anim_opts)
export("%>%")
export(anim_options)
export(anim_options_set)
@@ -16,6 +17,7 @@ export(animate_spread)
export(animate_union)
export(animate_union_all)
export(get_font_size)
export(is.anim_opts)
export(set_font_size)
importFrom(dplyr,anti_join)
importFrom(dplyr,arrange)

+ 8
- 7
R/animate_options.R 파일 보기

@@ -79,18 +79,19 @@ get_anim_opt <- function(anim_opt = NULL) {

# Animation Options Methods -----------------------------------------------

print.anim_opts <- function(ao, full = FALSE) {
if (!full) ao <- purrr::discard(ao, is.null)
#' @export
print.anim_opts <- function(x) {
# Replace ggproto (enter/exit functions) with their names
if ("enter" %in% names(ao)) ao$enter <- paste("ggproto:", names(ao$enter))
if ("exit" %in% names(ao)) ao$exit <- paste("ggproto:", names(ao$exit))
x <- capture.output(str(ao, no.list = TRUE))
if ("enter" %in% names(x)) x$enter <- paste("ggproto:", names(x$enter))
if ("exit" %in% names(x)) x$exit <- paste("ggproto:", names(x$exit))
anim_opts <- capture.output(str(x, no.list = TRUE))
cat(
paste0("<anim_options: ", length(ao), " options>"),
x, sep = "\n"
paste0("<anim_options: ", length(x), " options>"),
anim_opts, sep = "\n"
)
}

#' @export
is.anim_opts <- function(ao) inherits(ao, "anim_opts")



Loading…
취소
저장