Reverse Transform ACLED Data from Long to Wide
Source:R/acled_transform_wider.R
acled_transform_wider.Rd
Function to convert your ACLED's API calls (if monadic) back into the original dyadic forms.
Arguments
- data,
a dataframe or tibble containing your dataset.
- type,
a character string. One of five types: full_actors, main_actors, assoc_actors, source, or all.
full_actors: All actor and associated actor columns
main_actors: Actor 1 and Actor 2 columns
assoc_actors: All associated actor columns
source: The source column becomes dyadic
api_monadic: Use this option for data that is the output of the API's monadic option.
See also
Other Data Manipulation:
acled_transform_interaction()
,
acled_transform_longer()
Examples
if (FALSE) { # \dontrun{
# argen_acled <- acled_api(country = "Argentina",start_date = "2022-01-01",
# end_date="2022-02-01", acled_access = T, prompt = F)
# argen_acled_long_actors <- acled_transform_longer(argen_acled,
# type = "full_actor") # Transforming the data to long form
# argen_acled_wide <- acled_transform_wider(argen_acled_long_actors,
# type = "full_actor") # Transforming the data back to wide form
# nrow(argen_acled_wide) # Number of rows in the dataset
# [1] 145 # Wide form
# nrow(argen_acled_long_actors) # Number of rows in the dataset
# [1] 263 # Long form
} # }