From 4a23826c5b2955317d2b2514bb7a7abc40231aa1 Mon Sep 17 00:00:00 2001 From: lfagliano Date: Mon, 4 Dec 2023 12:31:00 +0400 Subject: [PATCH] Removing trackdown and acledexamples mentions --- .lintr | 6 -- .../.trackdown/acled_api.Rmd-chunk_info.rds | Bin 1143 -> 0 bytes .../.trackdown/acled_api.Rmd-header_info.rds | Bin 304 -> 0 bytes .../acled_deletions_api.Rmd-chunk_info.rds | Bin 1266 -> 0 bytes .../acled_deletions_api.Rmd-header_info.rds | Bin 305 -> 0 bytes .../acled_transformations.Rmd-chunk_info.rds | Bin 1184 -> 0 bytes .../acled_transformations.Rmd-header_info.rds | Bin 304 -> 0 bytes vignettes/articles/acled_api.Rmd | 21 +++- vignettes/articles/acled_deletions_api.Rmd | 99 ------------------ vignettes/articles/acled_transformations.Rmd | 16 ++- vignettes/articles/acled_update.Rmd | 7 +- vignettes/get_started.Rmd | 2 +- 12 files changed, 40 insertions(+), 111 deletions(-) delete mode 100644 .lintr delete mode 100644 vignettes/articles/.trackdown/acled_api.Rmd-chunk_info.rds delete mode 100644 vignettes/articles/.trackdown/acled_api.Rmd-header_info.rds delete mode 100644 vignettes/articles/.trackdown/acled_deletions_api.Rmd-chunk_info.rds delete mode 100644 vignettes/articles/.trackdown/acled_deletions_api.Rmd-header_info.rds delete mode 100644 vignettes/articles/.trackdown/acled_transformations.Rmd-chunk_info.rds delete mode 100644 vignettes/articles/.trackdown/acled_transformations.Rmd-header_info.rds delete mode 100755 vignettes/articles/acled_deletions_api.Rmd diff --git a/.lintr b/.lintr deleted file mode 100644 index 57f9f08..0000000 --- a/.lintr +++ /dev/null @@ -1,6 +0,0 @@ -linters: linters_with_defaults( - line_length_linter = line_length_linter(120) - - ) - -encoding: "UTF-8" diff --git a/vignettes/articles/.trackdown/acled_api.Rmd-chunk_info.rds b/vignettes/articles/.trackdown/acled_api.Rmd-chunk_info.rds deleted file mode 100644 index ab871890f50e413669cafe4e2244cdb656850f0a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1143 zcmV--1c>_|iwFP!000002HjW9ZyQAv-=qnoONt7JD;hR!Wg~luoewvKh6d7zN-2u+ zA&{zSGu|EBql{;l+1Vxr1yzVU2P6*MIKYhq*B&@>;Ko0KIB+Js*$;c{U86ctsf6X9 zcjq^6X5ReXoAJyirePSDjG5_aj{;gUJNn09*sS1!w@i z1bhSd4)6ouXTUFj-?VnG0ubN^pbFRmd=2;(@IBxsz!Si)fZqXs0H&3ysShu^emB6b zbSRf0`E;aqrinw6a#vzLdH$_hsyw+Pr^DQxm(4cn)@5XkM~Jwa^torBR27xa26_IjZWih*@0cGkCIi(9z;^n z0=a^CFky;WXb-1*7EUW>)6T*>ZAII#;vgH-Ou4_b^YL+eY4e`f`S5HK diff --git a/vignettes/articles/.trackdown/acled_api.Rmd-header_info.rds b/vignettes/articles/.trackdown/acled_api.Rmd-header_info.rds deleted file mode 100644 index c2ee04b2d6c2f74db7eb772aaed442df27676920..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 304 zcmV-00nh#)iwFP!0000028~fsOT#b_j$JETL=g4|!a#iLo+S@L(Fy|}d~hPnQ9={D zur`(C>ZW6`U+Pa$ud@~HlYuYy-EsHbUGhK)AwA-I9_a;0Nie;;4$m<*M8`)QBMut0 zypK59bDs>*zK3B*K|`)M8%1fVoYN*_!bmm+o$I&Si!N{Ct24)<+sTNQ6+BnKnJt7} z%5r5mUqF#3FFG>{K+%?Pc0n0CeY|h{iIHj@8?djNe>B?usf|shjoK`Y2Fv+R>uyq7 zN|f2`A7V>!wa&J~*-VycRVV}DLJ6tte2#DB{YnXpD3ojJ{3dwlKv-~%=PM&ye)KJq zfLcQn>emVhh^(ue=EAwoL{th8<0p$Ho%De%SL1e=`un^cUY~f-e0%|3@d&{F0RRBO CZHt)z diff --git a/vignettes/articles/.trackdown/acled_deletions_api.Rmd-chunk_info.rds b/vignettes/articles/.trackdown/acled_deletions_api.Rmd-chunk_info.rds deleted file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(3WiFD|M70OHUnc7F{30Da?f&Hw-a diff --git a/vignettes/articles/.trackdown/acled_deletions_api.Rmd-header_info.rds b/vignettes/articles/.trackdown/acled_deletions_api.Rmd-header_info.rds deleted file mode 100644 index 1764880702d358a97cf7f87dfbde39ecd71ad050..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 305 zcmV-10nYv(iwFP!0000029;4!OT#b_u3alGA_)5fVc=u;EO`(FCk$VFP!Z-Rp*g#< zHYv%~ZH$3`+Slo|wxWGA@Fm}O+Zx9mo!pDc(=#pY15&_|iaMYsX zL&AB(gNA=ZQN%FA90VWVKn|E0?fCWmOz=B^GSeyFn#yt|Q93|gl^jj2V9ZQ~Wrc#< zLfVxwYc0eQi#&eIQVoc}IwJTLo*Or%-YS&lrSzCFrx81xC-uoEb0KMn><=QIxYwG`g%*wkZB#n8}Cn=4F z8jRJy(Td3x%}ka~m{<2z$sY!UMFUAXWIG@urZw%e&i3Q4o^KTk-ob)nD(r$Qxi@oe zXK(k#o3Uz>9=;ZM-UNLFx&!(abOaiMegyqoS!ccZ81w)%1ZAKfKtF+Afqn-qSx`&U zBRK+$Cgh3H>}YOwxl1)Gc()us@BgwpZ3;XhxtX8;G20hws@Uqo!^7_tnTg$naG!aC zcNJA*e@MH6ZJioL8&h7wjhYT=Bv`yV9mlB{V;cHwm_f#=o(X31q3q{u5HEUNDAF~ef|p-;`RBfhUawWZhx1%?XvO$3*cL#ds2=3 zm>LQ-WUiTU%CM{6%Y-Nltv5(T%hInE4_zvqU4>3L0$^WXQ&L!OrHhuTT1$PoBnuFL$yh zoQw1>>|P^eZ@@Ldk0zuL5Lm6`gbP6u#$sY5;YpgA1!G#)(p`3xF>Qz$F!EUS?Nq`c z%;E>63BV-n^>*8%b~1F9l24nYa3tk^B(uaQ&a^eO6hZ630``-p4OJ$D1{Vq|y}7=D zU;SSKHfb!0XSZy$o15#GZmEKeZ8n&fSd}W&uPIaNGPy$b?J^hXZI`w=$dSkpbD4;- zgA?ZfQ^+wc6HR0<$3JG8BLsONcq5u-p+k0x>1-8MU=NT7SRX<3(0-kA9q6nZPKOoE*M2KBuaPelvpMO)?aH6X?n|i4jmi)vg;8EI`GSWJ zT^II{ZZ@GQzUYYguypE(%f4f#43Au0&4S=&Cz6YV^;|kWXDL;sMXWDz1eg=4hBp5! zt4yFGYYObJ&LKBs_B(V2`g0xxM5>sn&PG5Y|34=pjKV3>(m06xdk-33Dr6B-DB9oO zI5-H1pr{Pf$-7ohK`;tnM3a_cxZk9R%VM-?*r{(_?A8_L6xDBmWv4AcyG*of+I5*Y|u-+|M?v`3yd1sMzcae2(k@d+U>poa`I947R zD+w}5&pB~J(4?Q?Jy5yz|B5Un8iI7OJFgeL9E z+KZ%DHyHyzrk_T=))ur6hFtQyf4|&ao|t7>Bg?UEYvdBN+=uzCe?hhhDGtdA$w4PQ z9+RB5*lF>H@B0jMEL6z7xe-vM+LQuw4P2-E>iRyq;ZmURn6B}q#*nYDEMlpXx>SIS zd`)U_9t8euM%!brc?Jp_^Cjc_?D?_N??9?;1ZduN|Gl*TlN3RsWe(Y{?QZDHa!|W9 zZ>$jn;m4eS{;HRyA)So9_PD8N3dQDj5rq!3j#sHmBon5KqO2H|6)H`BhD=Hu*lI=*Pp_4y4{O(~W50RRAz C=$b_U diff --git a/vignettes/articles/acled_api.Rmd b/vignettes/articles/acled_api.Rmd index 4025b12..752e04f 100644 --- a/vignettes/articles/acled_api.Rmd +++ b/vignettes/articles/acled_api.Rmd @@ -114,13 +114,28 @@ As is common when executing API calls, handling large volumes of data requires s Imagine you are interested in events from “Brazil” occurring between January 1st, 2022, and December 1st, 2022. -```{r} +```{r, eval = FALSE} +library(acledR) +library(dplyr) + +#Note: This is simply an example–you will need to include your own credentials rather than the email and key placeholders that are included below. + +acled_access(email = "your_email", key = "your_key") + +df_br <- acled_api(country = c("Brazil"), + start_date = "2022-01-01", + end_date = "2022-12-01", + monadic = F, + acled_access = TRUE, + prompt = F) +``` +```{r,echo=FALSE} library(acledR) library(dplyr) #Note: This is simply an example–you will need to include your own credentials rather than the email and key placeholders that are included below. -acled_access(email = "acledexamples@gmail.com", key = "M3PWwg3DIdhHMuDiilp5") +acled_access(email = Sys.getenv("EMAIL_ADDRESS_EXAMPLES"), key = Sys.getenv("EXAMPLES_KEY")) df_br <- acled_api(country = c("Brazil"), start_date = "2022-01-01", @@ -130,6 +145,8 @@ df_br <- acled_api(country = c("Brazil"), prompt = F) ``` + + This returns a tibble that includes each ACLED event in “Brazil” during the specified period: ```{r} diff --git a/vignettes/articles/acled_deletions_api.Rmd b/vignettes/articles/acled_deletions_api.Rmd deleted file mode 100755 index d0e27d7..0000000 --- a/vignettes/articles/acled_deletions_api.Rmd +++ /dev/null @@ -1,99 +0,0 @@ ---- -title: "Deletions API: Keeping your dataset up to date" -output: rmarkdown::html_vignette -vignette: > - %\VignetteIndexEntry{Deletions API: Keeping your dataset up to date} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -```{r setup, echo=FALSE} -knitr::opts_chunk$set(echo = TRUE) - -defaultW <- getOption("warn") - -options(warn = -1) - -``` - -ACLED is a living dataset, which means changes happen regularly. - -Three types of changes are recurrent in ACLED's dataset: - -- New events - - These are the weekly addition of events, all are published with a new distinctive *event_id_cnty*. -- Updates of previously published events - - In some cases we modify published events, as new information may appear. For example, a particular actor has claimed responsibility over an attack, or the number of fatalities has changed. In these cases, the *event_id_cnty* remains the same, but the new information is updated and the old information overwritten - including the *timestamp*. -- Deletion of events - - In some cases, we have to delete previous events. This happens when new information surfaces indicating that the event no longer fits the scope of ACLED's dataset, or it hints that two events are the same and the events are then merged. In these cases, the event is removed, including the *event_id_cnty*. - -For users with a personal ACLED file, it is advised to check regularly which events are no longer in the actual ACLED dataset, and which have been updated. Otherwise, users risk having an outdated version. In this section we will walk through how to keep your dataset updated with the `acledR` package. - -## Keeping check of updates - `acled_update()` - -As we covered in the more detailed guide about [updating your dataset](https://acleddata.com/download/35179/), in some cases events are updated. When they are updated, their *event_id_cnty* remains the same but all the rest of the information gets updated and overwritten. - -Different from [deleted events](https://acled.github.io/ACLED-api-guide/deleted_endpoint.html), there is no separate API endpoint to check for updated events. When events are updated, their timestamp changes to the timestamp of the update. This means, that you can find the modified events by utilizing `acledR::acled_api()` and providing your latest timestamp (i.e. `max({your ACLED dataset}$timestamp))`) in the `timestamp` argument of the function. If you get duplicated events, these are likely to be updated events, which you should keep only the one with a higher timestamp. - -To simplify this process, `acledR` includes a function which makes the update for you by following the steps previously explained: `acled_update`. - -```{r, eval=F} -acled_update( - df, - additional_countries = NULL, - regions = NULL, - event_types = NULL, - acled_access = TRUE, - email = NULL, - key = NULL, - deleted = TRUE, - prompts = T) -``` - -The function is composed of the following arguments: - `df`: The dataframe to update, it has to have the same structure as ACLED's dyadic dataframes (i.e. the result of `acled_api()`) - `start_date`: Along with `end_date` these determine the temporal range for your update. They default to the date range of `df`. - `end_date`: Along with `start_date` these determine the temporal range for your update. They default to the date range of `df`. - `countries`: In case of your dataset to include particular countries, you can add them here so that the function filter new events to those countries. - `regions`: In case of your dataset to include particular regions, you can add them here so that the function filter new events to those regions. - `event_types`: In case of your dataset to include particular event_types, you can add them here so that the function filter new events to those event_types. - `acled_acess`: If you have already utilized `acled_acess()`, you can set this option as TRUE (default) and you wont be required to input email or key. - `email`: The email registered in [ACLED's Access Portal](https://developer.acleddata.com/). Not required if `acled_access = TRUE`. - `key`: The key registered in [ACLED's Access Portal](https://developer.acleddata.com/). Not required if `acled_access = TRUE`. - `deleted`: If TRUE, this function will also deal with deleted events, utilizing [ACLED API's deleted endpoint](https://acled.github.io/acledR/articles/acled_deletions_api.html). - `prompts`: Use this option to supress or allow prompts regarding your call. See `acled_api()`. - -`acled_update()` will utilize the dataset you provide to gather new events based on the timestamp, and add them to the original dataset, as well as remove any deleted events (if `deleted = TRUE`). - -## Examples - -In this section we will show how to use `acled_update` to keep your datasets updated. - -Load the older dataset: - -```{r, eval = T, message=FALSE} -library(acledR) -library(lubridate) -library(dplyr) -``` - -```{r} -acled_access(email = "acledexamples@gmail.com", key = "M3PWwg3DIdhHMuDiilp5") # This is an example, you will need to input your credentials. - -argen_dummy_acled_file <- acledR::acled_old_dummy # Here is our old personal ACLED dataset -``` - -When was the last time you gathered your dataset? The snippet below checks that. - -```{r} -latest_timestamp_unix <- max(argen_dummy_acled_file$timestamp) - -latest_timestamp <- as_datetime(latest_timestamp_unix) -``` - -The dataset has not been updated since `r print(latest_timestamp)`, so you need to update it. To do so, you just have to utilize `acled_update()`. In order to keep the update within the dates of our dataset, you can ignore the `start_date` and `end_date` arguments. Similarly, we going to keep `deleted=TRUE` to also remove deleted events. - -```{r} - -new_argen_dataset <- acled_update(argen_dummy_acled_file, - additional_countries = "Argentina", - acled_access = T, - prompts = FALSE) -``` - -Now your dataset captures modified and newly created events. - -Best of luck! - -```{r, echo=F} -options(warn = defaultW) -``` diff --git a/vignettes/articles/acled_transformations.Rmd b/vignettes/articles/acled_transformations.Rmd index 2314183..3c271b5 100644 --- a/vignettes/articles/acled_transformations.Rmd +++ b/vignettes/articles/acled_transformations.Rmd @@ -119,11 +119,11 @@ In this section you can walk through a potential use case for the transformation For this example, assume that you are interested in data from “South America” during the first half of 2023. **NOTE**: The email and key values below are only examples. You should provide your own credentials that you can create by using [ACLED’s website](https://apidocs.acleddata.com/get_started.html#getting-your-api-key). -```{r} +```{r, eval = False} library(acledR) -acled_access(email = "acledexamples@gmail.com", key = "M3PWwg3DIdhHMuDiilp5") +acled_access(email = "your_email", key = "your_key") df_sa <- acled_api(regions = "South America", start_date = "2023-01-01", @@ -132,7 +132,19 @@ df_sa <- acled_api(regions = "South America", acled_access = TRUE, prompt = F) ``` +```{r, echo=FALSE} + +library(acledR) +acled_access(email = Sys.getenv("EMAIL_ADDRESS_EXAMPLES"), key = Sys.getenv("EXAMPLES_KEY")) + +df_sa <- acled_api(regions = "South America", + start_date = "2023-01-01", + end_date = "2023-06-01", + monadic = F, + acled_access = TRUE, + prompt = F) +``` Now that your data are in long format with one actor per row, you can much more easily filter the data to retain only those events involving the "Military Forces of Colombia (2022-)": ```{r} diff --git a/vignettes/articles/acled_update.Rmd b/vignettes/articles/acled_update.Rmd index e406ed6..29098ea 100644 --- a/vignettes/articles/acled_update.Rmd +++ b/vignettes/articles/acled_update.Rmd @@ -90,9 +90,14 @@ library(lubridate) library(dplyr) ``` -```{r} +```{r, eval=FALSE} acled_access(email = "acledexamples@gmail.com", key = "M3PWwg3DIdhHMuDiilp5") # This is an example, you will need to input your credentials. +argen_dummy_acled_file <- acledR::acled_old_dummy # Here is our old personal ACLED dataset +``` +```{r, echo=FALSE} +acled_access(email = Sys.getenv("EMAIL_ADDRESS_EXAMPLES"), key = Sys.getenv("EXAMPLES_KEY")) # This is an example, you will need to input your credentials. + argen_dummy_acled_file <- acledR::acled_old_dummy # Here is our old personal ACLED dataset ``` diff --git a/vignettes/get_started.Rmd b/vignettes/get_started.Rmd index ce8f28d..b1c8180 100644 --- a/vignettes/get_started.Rmd +++ b/vignettes/get_started.Rmd @@ -54,7 +54,7 @@ Once you are registered, we encourage you to authenticate your credentials by us acled_access(email = "acledexamples@gmail.com", key = "M3PWwg3DIdhHMuDiilp5") # This is an example, you will need to input your credentials. ``` -```{r} +```{r,echo=FALSE} acled_access(email = Sys.getenv("EMAIL_ADDRESS_EXAMPLES"), key = Sys.getenv("EXAMPLES_KEY")) ```