Skip to content

Commit

Permalink
minor changes to documentation and run-all-script
Browse files Browse the repository at this point in the history
  • Loading branch information
polvis committed Dec 10, 2018
1 parent eb17a8b commit 81a4516
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion import/import-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Initial version of the codebook was created by Phillip Hocks and Jan
Fischer (University of Bremen) in 2015.
This work was funded by a small research grant of the University of Bremen (M8 Plus).

More information: [partyfacts.herokuapp.com](http://www.partyfacts.org) --
More information: [partyfacts.org](http://www.partyfacts.org) --
[github.com/hdigital/partyfactsdata](https://github.com/hdigital/partyfactsdata)


Expand Down
6 changes: 3 additions & 3 deletions import/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ For a detailed instruction how to contribute your dataset, see [our import guide

# R packages and snippets

Most of the data preparation is done in R. Some scripts may require additional packages. We have a strong preference for [RStudio R packages](https://www.rstudio.com/products/rpackages/) (esp. [tidyverse](http://tidyverse.org/)). `run-all.R` includes information about used packages.
Most of the data preparation is done in R. Some scripts may require additional packages. We have a strong preference for [RStudio R packages](https://www.rstudio.com/products/rpackages/) (esp. [tidyverse](https://tidyverse.org/)). `run-all.R` includes information about used packages.

Please use the [tidyverse R Style Guide](http://style.tidyverse.org/) when writing code in R.
Please use the [tidyverse R Style Guide](https://style.tidyverse.org/) when writing code in R.

Party Facts import requires ISO3 country codes. `country.csv` includes the respective information. Recode country names with the R-package `countrycode`

```r
# Example country recoding from Marpor import
marpor <- marpor %>%
mutate(country = countrycode(countryname, "country.name", "iso3c",
custom_match = c(`Northern Ireland`="NIR")))
custom_match = c(`Northern Ireland` = "NIR")))
if(any(is.na(marpor$country))) {
warning("Country name clean-up needed")
}
Expand Down
7 changes: 3 additions & 4 deletions import/run-all.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# install and load all required packages

packages <- c("tidyverse", "countrycode", "RCurl")
packages <- c("tidyverse", "countrycode", "RCurl", "haven", "dbplyr")
lapply(packages, function(pack) {
if ( ! pack %in% installed.packages()[,"Package"]) {
install.packages(pack, repos="http://cran.r-project.org")
install.packages(pack, repos = "https://cran.r-project.org")
}
require(pack, character.only=TRUE, quietly=TRUE)
require(pack, character.only = TRUE, quietly = TRUE)
})
update.packages(ask=FALSE)


# run import scripts in all sub-folders
Expand Down

0 comments on commit 81a4516

Please sign in to comment.