Compare commits
4
Commits
efddf043e3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2663b2e90 | ||
|
|
ab0fa33172 | ||
|
|
83cdcc279b | ||
|
|
1e9c9ba651 |
@@ -272,9 +272,10 @@ read_from_csv <- function(path="inst/csv/") {
|
||||
res
|
||||
}
|
||||
|
||||
#' @param path directory of csv files to read
|
||||
#' read data from csv files if they exist already
|
||||
#' otherwise fetch protocols and then write the data into csv files
|
||||
#' Read records from csv or fetch
|
||||
#'
|
||||
#' @param path base directory where csv files are expected under path/csv
|
||||
#' and possibly records fetched and stored under path/records
|
||||
#'
|
||||
#' @export
|
||||
read_from_csv_or_fetch <- function(path="inst/") {
|
||||
|
||||
@@ -9,7 +9,34 @@ Using the `remotes` package, this is easily installed via:
|
||||
```r
|
||||
remotes::install_url("https://git.flavigny.de/christian/hateimparlament/archive/master.zip")
|
||||
```
|
||||
If you want to build the vignettes, pass `build_vignettes = TRUE`.
|
||||
If you want to build the vignettes, pass `build_vignettes = TRUE`. This takes a long time and
|
||||
fails sometimes, if bundestag.de times out, since
|
||||
in the beginning the necessary records are neither fetched nor parsed.
|
||||
|
||||
## Install with vignettes
|
||||
|
||||
An alternative for building
|
||||
the vignettes is to clone the repository and build the vignettes manually, e.g. on Linux
|
||||
```
|
||||
git clone https://git.flavigny.de/christian/hateimparlament
|
||||
cd hateimparlament
|
||||
```
|
||||
Then open a `R` shell and do
|
||||
```r
|
||||
devtools::load_all() # load package
|
||||
devtools::wd() # set working directory
|
||||
```
|
||||
Then fetch all records, read them and write the parsed tibbles to csv files.
|
||||
```r
|
||||
fetch_all(create = TRUE)
|
||||
read_all() %>% repair() -> res
|
||||
write_to_csv(res, create = TRUE)
|
||||
```
|
||||
Now you can install the package with vignettes by using
|
||||
```r
|
||||
devtools::install(build_vignettes = TRUE)
|
||||
```
|
||||
This makes all vignettes available via `browseVignettes()`.
|
||||
|
||||
# Features
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/parse.R
|
||||
\name{read_from_csv_or_fetch}
|
||||
\alias{read_from_csv_or_fetch}
|
||||
\title{Read records from csv or fetch}
|
||||
\usage{
|
||||
read_from_csv_or_fetch(path = "inst/")
|
||||
}
|
||||
\arguments{
|
||||
\item{path}{base directory where csv files are expected under path/csv
|
||||
and possibly records fetched and stored under path/records}
|
||||
}
|
||||
\description{
|
||||
Read records from csv or fetch
|
||||
}
|
||||
Reference in New Issue
Block a user