Procházet zdrojové kódy

add further checks for invalid records

genderequality-alternative
flavis před 4 roky
rodič
revize
4093cb603c
1 změnil soubory, kde provedl 7 přidání a 0 odebrání
  1. +7
    -0
      R/parse.R

+ 7
- 0
R/parse.R Zobrazit soubor

@@ -76,6 +76,13 @@ read_one <- function(name, path) {
verlauf <- xml_find_first(x, "sitzungsverlauf") verlauf <- xml_find_first(x, "sitzungsverlauf")
speakerl <- xml_find_first(x, "rednerliste") speakerl <- xml_find_first(x, "rednerliste")


# check if record is invalid or empty (every record should have at least
# one speech, a speaker and a date
if (is.na(date) || length(verlauf) == 0 || length(speakerl) == 0) {
warning("Invalid record found. Skipping.")
return(NULL)
}

xml_children(speakerl) %>% xml_children(speakerl) %>%
parse_speakerlist() -> parse_speakerlist() ->
speaker speaker


Načítá se…
Zrušit
Uložit