This article provides example code showing how the MeasureR framework can be implemented to calculate a custom metric.
Say that after working through the MeasureR framework, we decided that we thought:
\[\text{Influence} = \frac{1}{2}\text{Followers} + \frac{1}{2}\text{Reach}\]
with_metric <- retweet_example %>%
# Standardise the variables we want to combine
mutate(across(.cols = c(followers, `Reach (SUM)`),
.fns = ~as.vector(scale(.)),
.names = "{col}_scale")) %>%
# Calculate a row-wise mean (for equal weighting) to define the new metric
rowwise() %>%
mutate(influence = mean(followers_scale, `Reach (SUM)_scale`))
# Check if there are any missing values in our custom metric
sum(is.na(with_metric$influence))
## [1] 0