R/utility_functions.R
create_weapon_details.RdThis function processes a data frame containing raw weapon event messages
(in the column weapon_message) and adds new columns describing the type,
effect, and usage details of the weapon. Specifically, it:
Extracts the weapon_type from the message using a regex pattern.
Classifies the weapon_effect (e.g., kill, stop, noEffect).
Determines which hand (weapon_hand) the weapon was used with.
Flags whether a weapon was picked up (weapon_picked_up).
create_weapon_details(df)The input data frame with four new factor columns:
weapon_type, weapon_effect, weapon_hand, and weapon_picked_up.
df <- create_weapon_details(df)
#> Error in mutate(., weapon_type = as.factor(weapon_type), weapon_effect = as.factor(weapon_effect), weapon_hand = as.factor(weapon_hand), weapon_picked_up = as.factor(weapon_picked_up)): could not find function "mutate"