Skip to content
Snippets Groups Projects
Commit 79e281db authored by David Fuhry's avatar David Fuhry :fist:
Browse files

Merge branch '41-return-na-if-no-data-was-found' into 'master'

Replace return(NULL) with return(NA)

Closes #41

See merge request !40
parents d31acde2 1adf0b12
No related branches found
No related tags found
1 merge request!40Replace return(NULL) with return(NA)
......@@ -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)
}
}
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment