diff --git a/processing/wikiproc/R/get_birthdate.R b/processing/wikiproc/R/get_birthdate.R index a316ca2e2c40317d361184d837c1d732d36a602c..555c51ce9a102fdb415ca5e01b0920f01ad4d6cb 100644 --- a/processing/wikiproc/R/get_birthdate.R +++ b/processing/wikiproc/R/get_birthdate.R @@ -43,8 +43,8 @@ get_birthdate <- function(article) { } else { - # Return Null if there is no birthdate - return(NULL) + # Return NA if there is no birthdate + return(NA) } } diff --git a/processing/wikiproc/R/get_birthplace.R b/processing/wikiproc/R/get_birthplace.R index e0310bdad7882b1f3a404115eb1637fb0d9cd52b..70593babfc04e08c9555bb1e6fe184179ee67095 100644 --- a/processing/wikiproc/R/get_birthplace.R +++ b/processing/wikiproc/R/get_birthplace.R @@ -4,7 +4,7 @@ #' This script extracts Birthplace from physicist texts #' Try to get the infobox and extract the birthplace -#' If there is no infobox, 0 will be returned as +#' If there is no infobox, NA will be returned as #' birthplace is hard to extract from text #' #' @export @@ -14,7 +14,7 @@ get_birthplace <- function(article) { # If there is no infobox we return 0 if(!grepl("vcard", article)) { - return(0) + return(NA) } # Use infobox to get Birthplace diff --git a/processing/wikiproc/R/get_no_of_spouses.R b/processing/wikiproc/R/get_no_of_spouses.R index c0fb31eeec13d9e4724da79a6ec7a3a35253e40b..86ad18f1940c813c5051d2a3db5c5582bc6e7e81 100755 --- a/processing/wikiproc/R/get_no_of_spouses.R +++ b/processing/wikiproc/R/get_no_of_spouses.R @@ -15,20 +15,20 @@ #' @examples #' \dontrun{ #' articles <- get_data() -#' +#' #' no.spouses <- get_no_of_spouses(articles$Text[54]) -#' -#' no,spouses +#' +#' no.spouses #' } get_no_of_spouses <- function(article) { - + # If there is no infobox we assume there were no spouses if(!grepl("vcard", article)) { return(0) } - + infoBox <- get_infobox(article) - + # Get the spouse field spouses <- infoBox[infoBox$Desc %like% "Spouse",]$Content # Remove everything in parentheses