This 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)

Arguments

df

A data frame with at least a weapon_message column.

Value

The input data frame with four new factor columns: weapon_type, weapon_effect, weapon_hand, and weapon_picked_up.

Examples

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"