From 1adf0b121b181be39c3f1e76fbe3bf470162c944 Mon Sep 17 00:00:00 2001 From: Lulu Roth <ls80zyse@studserv.uni-leipzig.de> Date: Thu, 17 Jan 2019 15:20:54 +0100 Subject: [PATCH] Replace return(NULL) with return(NA) * fix some typos fixes #41 --- processing/wikiproc/R/get_birthdate.R | 4 ++-- processing/wikiproc/R/get_birthplace.R | 4 ++-- processing/wikiproc/R/get_no_of_spouses.R | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/processing/wikiproc/R/get_birthdate.R b/processing/wikiproc/R/get_birthdate.R index a316ca2..555c51c 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 e0310bd..70593ba 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 c0fb31e..86ad18f 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 -- GitLab