[R] family
Val
valkremk at gmail.com
Sat Nov 18 01:28:09 CET 2017
Hi all,
I am reading a huge data set(12M rows) that contains family information,
Offspring, Parent1 and Parent2
Parent1 and parent2 should be in the first column as an offspring
before their offspring information. Their parent information (parent1
and parent2) should be set to zero, if unknown. Also the first
column should be unique.
Here is my sample data set and desired output.
fam <- read.table(textConnection(" offspring Parent1 Parent2
Smith Alex1 Alexa
Carla Alex1 0
Jacky Smith Abbot
Jack 0 Jacky
Almo Jack Carla
"),header = TRUE)
desired output.
Offspring Parent1 Parent2
Alex1 0 0
Alexa 0 0
Abbot 0 0
Smith Alex1 Alexa
Carla Alex1 0
Jacky Smith Abbot
Jack 0 Jacky
Almo Jack Carla
Thank you.
More information about the R-help
mailing list