as.ped | R Documentation |
Conversions to ped objects
as.ped(x, ...)
## S3 method for class 'data.frame'
as.ped(
x,
famid_col = NA,
id_col = NA,
fid_col = NA,
mid_col = NA,
sex_col = NA,
marker_col = NA,
locusAttributes = NULL,
missing = 0,
sep = NULL,
validate = TRUE,
...
)
x |
Any object. |
... |
Not used. |
famid_col |
Index of family ID column. If NA, the program looks for a column named "famid" (ignoring case). |
id_col |
Index of individual ID column. If NA, the program looks for a column named "id" (ignoring case). |
fid_col |
Index of father ID column. If NA, the program looks for a column named "fid" (ignoring case). |
mid_col |
Index of mother ID column. If NA, the program looks for a column named "mid" (ignoring case). |
sex_col |
Index of column with gender codes (0 = unknown; 1 = male; 2 = female). If NA, the program looks for a column named "sex" (ignoring case). If this is not found, genders of parents are deduced from the data, leaving the remaining as unknown. |
marker_col |
Index vector indicating columns with marker alleles. If NA,
all columns to the right of all pedigree columns are used. If |
locusAttributes |
Passed on to |
missing |
Passed on to |
sep |
Passed on to |
validate |
A logical indicating if the pedigree structure should be validated. |
A ped
object or a list of such.
df = data.frame(famid = c("S1", "S2"),
id = c("A", "B"),
fid = 0,
mid = 0,
sex = 1)
# gives a list of two singletons
as.ped(df)
# Trio
df1 = data.frame(id = 1:3, fid = c(0,0,1), mid = c(0,0,2), sex = c(1,2,1))
as.ped(df1)
# Disconnected example: Trio (1-3) + singleton (4)
df2 = data.frame(id = 1:4, fid = c(2,0,0,0), mid = c(3,0,0,0),
M = c("1/2", "1/1", "2/2", "3/4"))
as.ped(df2)
# Two singletons
df3 = data.frame(id = 1:2, fid = 0, mid = 0, sex = 1)
as.ped(df3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.