Просмотр исходного кода

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 лет назад
Родитель
Сommit
bbb8410c78
2 измененных файлов: 10 добавлений и 7 удалений
  1. +2
    -0
      NAMESPACE
  2. +8
    -7
      R/animate_options.R

+ 2
- 0
NAMESPACE Просмотреть файл

# Generated by roxygen2: do not edit by hand # Generated by roxygen2: do not edit by hand


S3method(print,anim_opts)
export("%>%") export("%>%")
export(anim_options) export(anim_options)
export(anim_options_set) export(anim_options_set)
export(animate_union) export(animate_union)
export(animate_union_all) export(animate_union_all)
export(get_font_size) export(get_font_size)
export(is.anim_opts)
export(set_font_size) export(set_font_size)
importFrom(dplyr,anti_join) importFrom(dplyr,anti_join)
importFrom(dplyr,arrange) importFrom(dplyr,arrange)

+ 8
- 7
R/animate_options.R Просмотреть файл



# Animation Options Methods ----------------------------------------------- # 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 # 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( 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") is.anim_opts <- function(ao) inherits(ao, "anim_opts")





Загрузка…
Отмена
Сохранить