Skip to content

Commit c051a25

Browse files
rename
1 parent fd3b709 commit c051a25

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

R/checkIDs.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ checkIDs <- function(ped, verbose = FALSE, repair = FALSE) {
4141
cat("Validation Results:\n")
4242
message(validation_results)
4343
}
44-
if (repair) {
44+
if (repair == TRUE) {
4545
if (verbose == TRUE) {
4646
cat("Attempting to repair:\n")
4747
cat("Step 1: Attempting to repair non-unique IDs...\n")

R/insertEven.R renamed to R/helpInsertEven.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#' The function takes two vectors, m and n, and inserts the elements of m evenly into n.
1010
#' If the length of m is greater than the length of n, the vectors are swapped, and the insertion proceeds.
1111
#' The resulting vector is a combination of m and n, with the elements of m evenly distributed within n.
12-
#' @export
1312
#' @seealso \code{\link{SimPed}} for the main function that uses this supporting function.
1413

1514
insertEven <- function(m, n, verbose = FALSE) {

R/cleanPedigree.R renamed to R/helpNames.R

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,53 @@ standardizeColnames <- function(df, verbose = FALSE) {
4141

4242
return(df)
4343
}
44+
#' Restore Original Column Names in a Pedigree Dataframe
45+
#'
46+
#' This function restores the original column names of a pedigree dataframe
47+
#' based on user-specified names. It is useful for reverting standardized column
48+
#' names back to their original names after processing.
49+
#' @param ped A pedigree dataframe with standardized column names.
50+
#' @param famID The original name for the family ID column. Default is "fam
51+
#' ID".
52+
#' @param personID The original name for the person ID column. Default is "ID".
53+
#' @param momID The original name for the mother ID column. Default is "momID".
54+
#' @param dadID The original name for the father ID column. Default is "dadID".
55+
#' @param gen The original name for the generation column. Default is "gen".
56+
#' @param patID The original name for the paternal ID column. Default is "patID".
57+
#' @param matID The original name for the maternal ID column. Default is "matID".
58+
#' @param spID The original name for the spouse ID column. Default is "spID".
59+
#' @param twinID The original name for the twin ID column. Default is "twinID".
60+
#' @param zygosity The original name for the zygosity column. Default is "zygosity".
61+
#' @param sex The original name for the sex column. Default is "sex".
62+
#' @return A pedigree dataframe with restored original column names.
63+
restorePedColnames <- function(ped,
64+
famID = "famID",
65+
personID = "ID",
66+
momID = "momID",
67+
dadID = "dadID",
68+
gen = "gen",
69+
patID = "patID",
70+
matID = "matID",
71+
spID = "spID",
72+
twinID = "twinID",
73+
zygosity = "zygosity",
74+
sex = "sex"
75+
) {
76+
77+
names(ped)[names(ped) == "ID"] <- personID
78+
names(ped)[names(ped) == "momID"] <- momID
79+
names(ped)[names(ped) == "dadID"] <- dadID
80+
names(ped)[names(ped) == "famID"] <- famID
81+
names(ped)[names(ped) == "gen"] <- gen
82+
names(ped)[names(ped) == "patID"] <- patID
83+
names(ped)[names(ped) == "matID"] <- matID
84+
names(ped)[names(ped) == "spID"] <- spID
85+
names(ped)[names(ped) == "twinID"] <- twinID
86+
names(ped)[names(ped) == "zygosity"] <- zygosity
87+
names(ped)[names(ped) == "sex"] <- sex
88+
ped
89+
}
90+
4491

4592

4693
# Repair Pedigree

0 commit comments

Comments
 (0)