Learn R Programming

penetrance (version 0.1.4)

transformDF: Transform Data Frame

Description

This function transforms a data frame from the standard format used in Fam3PRO into the required format which conforms to the requirements of penetrance (and clipp).

Usage

transformDF(df)

Value

A data frame in the format required for clipp with the following columns:

individual

ID of the individual

isProband

Indicator if the individual is a proband

family

Family ID

mother

Mother's ID

father

Father's ID

aff

Affection status

sex

Sex (2 for female, 1 for male)

age

Age at diagnosis or current age

geno

Genotype information (internal format)

Arguments

df

The input data frame in the usual Fam3PRO format.

Details

This function implements a two-tier naming convention:

  • User-facing input: uppercase 'Geno' (values 0 or 1)

  • Internal processing: lowercase 'geno' (values "1/1" or "1/2")

The transformation converts 'Geno' = 1 (carrier) to 'geno' = "1/2", and 'Geno' = 0 (non-carrier) to 'geno' = "1/1". This separation provides clear distinction between user interface and internal implementation.

Examples

Run this code
# Create example data frame
df <- data.frame(
  ID = 1:2,
  PedigreeID = c(1,1),
  Sex = c(0,1),
  MotherID = c(NA,1),
  FatherID = c(NA,NA),
  isProband = c(1,0),
  CurAge = c(45,20),
  isAff = c(1,0),
  Age = c(40,NA),
  Geno = c(1,0)
)

# Transform the data frame
transformed_df <- transformDF(df)

Run the code above in your browser using DataLab