@@ -164,7 +164,7 @@ readGedcom <- function(file_path,
164164 )
165165 }
166166
167- return ( df_temp )
167+ df_temp
168168}
169169
170170# --- SUBFUNCTIONS ---
@@ -196,7 +196,7 @@ splitIndividuals <- function(lines, verbose = FALSE) {
196196 blocks [[length(blocks ) + 1 ]] <- block
197197 }
198198 if (verbose == TRUE ) message(" Found " , length(blocks ), " individual blocks" )
199- return ( blocks )
199+ blocks
200200}
201201
202202# ' Initialize an Empty Individual Record
@@ -321,7 +321,7 @@ parseIndividualBlock <- function(block, pattern_rows, all_var_names, verbose = F
321321 if (is.na(record $ personID )) {
322322 return (NULL )
323323 }
324- return ( record )
324+ record
325325}
326326
327327# ' @title Parse Name Line
@@ -336,7 +336,7 @@ parseNameLine <- function(line, record) {
336336 record $ name_given <- stringr :: str_extract(record $ name , " .*(?= /)" )
337337 record $ name_surn <- stringr :: str_extract(record $ name , " (?<=/).*(?=/)" )
338338 record $ name <- stringr :: str_squish(stringr :: str_replace(record $ name , " /" , " " ))
339- return ( record )
339+ record
340340}
341341
342342# ' Process Event Lines (Birth or Death)
@@ -365,7 +365,7 @@ processEventLine <- function(event, block, i, record, pattern_rows) {
365365 if (i + 4 < = n_lines ) record $ death_lat <- extract_info(block [i + 4 ], " LATI" )
366366 if (i + 5 < = n_lines ) record $ death_long <- extract_info(block [i + 5 ], " LONG" )
367367 }
368- return ( record )
368+ record
369369}
370370
371371# ' Apply Tag Mappings to a Line
@@ -394,7 +394,7 @@ applyTagMappings <- function(line, record, pattern_rows, tag_mappings) {
394394 return (list (record = record , matched = TRUE ))
395395 }
396396 }
397- return ( list (record = record , matched = FALSE ) )
397+ list (record = record , matched = FALSE )
398398}
399399
400400
@@ -463,7 +463,7 @@ countPatternRows <- function(file) {
463463 num_date_rows = pattern_counts [" DATE" ],
464464 num_caus_rows = pattern_counts [" CAUS" ]
465465 )
466- return ( num_rows )
466+ num_rows
467467}
468468
469469# ' Process a GEDCOM Tag
@@ -484,8 +484,8 @@ process_tag <- function(tag, field_name, pattern_rows, line, vars,
484484 count_name <- paste0(" num_" , tolower(tag ), " _rows" )
485485 matched <- FALSE
486486 if (! is.null(pattern_rows [[count_name ]]) &&
487- pattern_rows [[count_name ]] > 0 &&
488- grepl(paste0(" " , tag ), line )) {
487+ pattern_rows [[count_name ]] > 0 &&
488+ grepl(paste0(" " , tag ), line )) {
489489 value <- if (is.null(extractor )) {
490490 extract_info(line , tag )
491491 } else {
@@ -498,7 +498,7 @@ process_tag <- function(tag, field_name, pattern_rows, line, vars,
498498 }
499499 matched <- TRUE
500500 }
501- return ( list (vars = vars , matched = matched ) )
501+ list (vars = vars , matched = matched )
502502}
503503
504504# ' Post-process GEDCOM Data Frame
@@ -536,7 +536,7 @@ postProcessGedcom <- function(df_temp,
536536 df_temp $ FAMC <- NULL
537537 df_temp $ FAMS <- NULL
538538 }
539- return ( df_temp )
539+ df_temp
540540}
541541
542542# ' Process Parents Information from GEDCOM Data
@@ -564,7 +564,7 @@ processParents <- function(df_temp, datasource) {
564564 return (df_temp )
565565 }
566566 df_temp <- mapFAMC2parents(df_temp , family_to_parents )
567- return ( df_temp )
567+ df_temp
568568}
569569
570570# ' Create a Mapping from Family IDs to Parent IDs
@@ -580,7 +580,7 @@ mapFAMS2parents <- function(df_temp) {
580580 return (NULL )
581581 }
582582 family_to_parents <- list ()
583- for (i in 1 : nrow(df_temp )) {
583+ for (i in seq_len( nrow(df_temp ) )) {
584584 if (! is.na(df_temp $ FAMS [i ])) {
585585 fams_ids <- unlist(strsplit(df_temp $ FAMS [i ], " , " ))
586586 for (fams_id in fams_ids ) {
@@ -601,7 +601,7 @@ mapFAMS2parents <- function(df_temp) {
601601 }
602602 }
603603 }
604- return ( family_to_parents )
604+ family_to_parents
605605}
606606
607607# ' Assign momID and dadID based on family mapping
@@ -616,7 +616,7 @@ mapFAMS2parents <- function(df_temp) {
616616mapFAMC2parents <- function (df_temp , family_to_parents ) {
617617 df_temp $ momID <- NA_character_
618618 df_temp $ dadID <- NA_character_
619- for (i in 1 : nrow(df_temp )) {
619+ for (i in seq_len( nrow(df_temp ) )) {
620620 if (! is.na(df_temp $ FAMC [i ])) {
621621 famc_ids <- unlist(strsplit(df_temp $ FAMC [i ], " , " ))
622622 for (famc_id in famc_ids ) {
@@ -631,7 +631,7 @@ mapFAMC2parents <- function(df_temp, family_to_parents) {
631631 }
632632 }
633633 }
634- return ( df_temp )
634+ df_temp
635635}
636636
637637# ' collapse Names
@@ -644,18 +644,18 @@ mapFAMC2parents <- function(df_temp, family_to_parents) {
644644collapseNames <- function (verbose , df_temp ) {
645645 if (verbose == TRUE ) message(" Combining Duplicate Columns" )
646646
647- if (! all(is.na(df_temp $ name_given_pieces )) | ! all(is.na(df_temp $ name_given ))) {
647+ if (! all(is.na(df_temp $ name_given_pieces )) || ! all(is.na(df_temp $ name_given ))) {
648648 result <- combine_columns(df_temp $ name_given , df_temp $ name_given_pieces )
649649 df_temp $ name_given <- result $ combined
650650 if (! result $ retain_col2 ) df_temp $ name_given_pieces <- NULL
651651 }
652652
653- if (! all(is.na(df_temp $ name_surn_pieces )) | ! all(is.na(df_temp $ name_surn ))) {
653+ if (! all(is.na(df_temp $ name_surn_pieces )) || ! all(is.na(df_temp $ name_surn ))) {
654654 result <- combine_columns(df_temp $ name_surn , df_temp $ name_surn_pieces )
655655 df_temp $ name_surn <- result $ combined
656656 if (! result $ retain_col2 ) df_temp $ name_surn_pieces <- NULL
657657 }
658- return ( df_temp )
658+ df_temp
659659}
660660
661661# ' Combine Columns
@@ -672,10 +672,10 @@ combine_columns <- function(col1, col2) {
672672 conflicts <- ! is.na(col1_lower ) & ! is.na(col2_lower ) & col1_lower != col2_lower
673673 if (any(conflicts )) {
674674 warning(" Columns have conflicting values. They were not merged." )
675- return ( list (combined = col1 , retain_col2 = TRUE ) )
675+ list (combined = col1 , retain_col2 = TRUE )
676676 } else {
677677 combined <- ifelse(is.na(col1 ), col2 , col1 )
678- return ( list (combined = combined , retain_col2 = FALSE ) )
678+ list (combined = combined , retain_col2 = FALSE )
679679 }
680680}
681681
0 commit comments