mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 07:10:50 +01:00
(v0.7.1.9056) mo and ab subsetting
This commit is contained in:
1 parent
7108454ba5
commit
920212e815
46 files changed
+144
-69
No files matched your search
@@ -282,10 +282,42 @@ as.data.frame.ab <- function (x, ...) {
|
||||
#' @exportMethod [.ab
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[.ab" <- function (x, ...) {
|
||||
# this function is needed to preserve the "ab" class for any subsetting, like df %>% filter(...)
|
||||
"[.ab" <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
structure(y, class = "ab")
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
#' @exportMethod [<-.ab
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[<-.ab" <- function(value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(value)
|
||||
y
|
||||
}
|
||||
#' @exportMethod [[.ab
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[[.ab" <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
#' @exportMethod [[<-.ab
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[[<-.ab" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(value)
|
||||
y
|
||||
}
|
||||
#' @exportMethod c.ab
|
||||
#' @export
|
||||
#' @noRd
|
||||
c.ab <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
|
||||
#' @importFrom pillar type_sum
|
||||
|
||||
Reference in new issue
Block a user