Skip to content

Commit

Permalink
calc
Browse files Browse the repository at this point in the history
  • Loading branch information
robitalec committed Oct 3, 2024
1 parent b227579 commit 94ae322
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/centroid_group.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,9 @@ centroid_group <- function(
message(paste(out_ycol, 'column will be overwritten by this function'))
data.table::set(DT, j = out_ycol, value = NULL)
}

DT[, c(out_xcol) := mean(.SD[[xcol]], na.rm = na.rm), by = c(group)]
DT[, c(out_ycol) := mean(.SD[[ycol]], na.rm = na.rm), by = c(group)]

return(DT[])
}

0 comments on commit 94ae322

Please sign in to comment.