Skip to content

Commit

Permalink
Removes attributes and classes only of affected columns
Browse files Browse the repository at this point in the history
  • Loading branch information
eliocamp committed Jun 9, 2023
1 parent a889aac commit 74f4157
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/unperiodic.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ unperiodic.periodic_df <- function(object, ...) {
}

for (i in seq_along(cols)) {
data.table::setattr(object[[cols[i]]], "period", NULL)
data.table::setattr(object[[cols[i]]], "class", class(object[[cols[i]]])[class(object[[cols[i]]]) != "sticky"])
data.table::setattr(object, "class", class(object)[class(object) != "periodic_df"])

# class(object[[cols[i]]]) <- class(object[[cols[i]]])[class(object[[cols[i]]]) != "sticky"]
# class(object) <- class(object)[class(object) != "periodic_df"]
if (inherits(object[[cols[i]]], "sticky")) {
data.table::setattr(object[[cols[i]]], "period", NULL)
data.table::setattr(object[[cols[i]]], "class", setdiff(class(object[[cols[i]]]), "sticky"))
}
}

data.table::setattr(object, "class", setdiff(class(object), "periodic_df"))
# browser()
if (.should.copy(object)) {
return(object)
} else {
Expand Down

0 comments on commit 74f4157

Please sign in to comment.