Skip to content

Commit

Permalink
make unique a proper S4 method
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Jun 14, 2020
1 parent 76e0276 commit 291438e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions R/SoilProfileCollection-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,9 @@ setMethod(
}
)

# overload unique() via digest eval of unique profiles
uniqueSPC <- function(x, vars) {
setMethod(f = 'unique',
signature(x = "SoilProfileCollection"),
definition = function(x, vars) {
# compute hash by profile, for selected variables
md5 <- profileApply(x, function(i) {
# unlist in order to drop row names
Expand All @@ -575,11 +576,7 @@ uniqueSPC <- function(x, vars) {
# return an index of unique profiles
# down-grade to un-named vector of indices
return(as.vector(u.profiles))
}

setMethod(f = 'unique',
signature(x = "SoilProfileCollection"),
definition = uniqueSPC)
})

## standard column access: search horizons, then site
setMethod("$", signature(x = "SoilProfileCollection"),
Expand Down

0 comments on commit 291438e

Please sign in to comment.