Skip to content

Commit

Permalink
fix for #304
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Sep 30, 2023
1 parent fb4a634 commit b957c55
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions R/mukey-WCS.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,8 @@ mukey.wcs <- function(aoi, db = c('gNATSGO', 'gSSURGO', 'RSS', 'STATSGO', 'PR_SS
# remove tempfile
unlink(tf)

## TODO: use terra::as.factor()
# build RAT
# NB: unique() takes na.rm argument on terra >1.5-21 <https://github.com/rspatial/terra/issues/561>
uids <- na.omit(terra::unique(r)[[1]])
rat <- data.frame(ID = uids,
mukey = uids)
levels(r)[[1]] <- rat
r <- terra::as.factor(r)

# set layer name in object
names(r) <- 'mukey'
Expand Down

0 comments on commit b957c55

Please sign in to comment.