On 17-Aug-2014 03:50:33 John McKown wrote:
> On Sat, Aug 16, 2014 at 9:02 PM, Kate Ignatius
> wrote:
>
>> Actually - your code is not wrong... because this is a large file I
>> went through the file to see if there was anything wrong with it -
>> looks like there are two fathers or three mothers
Perhaps I am missing something but I do not get the same result:
x <- read.table(textConnection("Family.ID Sample.ID Relationship
2702 349 mother
2702 3456 sibling
2702 9980 sibling
3064 3 father
3064 4 mother
3064 5sibling
3064 86 sibling
3064 87 sibling"), header = TRUE
Dear Kate,
Try this:
res <- do.call(rbind, lapply(xs, function(l){
l$PID <- l$MID <- 0
father <- with(l, Relationship == 'father')
mother <- with(l, Relationship == 'mother')
if(sum(father) == 0)
l$PID[l$Relationship == 'sibling'] <- 0
else l$PID[l$Relationship == 'sibling'] <- l$Sample.ID[fa
On Sat, Aug 16, 2014 at 9:02 PM, Kate Ignatius
wrote:
> Actually - your code is not wrong... because this is a large file I
> went through the file to see if there was anything wrong with it -
> looks like there are two fathers or three mothers in some families.
> Taking these duplicates out fixe
Actually - your code is not wrong... because this is a large file I
went through the file to see if there was anything wrong with it -
looks like there are two fathers or three mothers in some families.
Taking these duplicates out fixed the problem.
Sorry about the confusion! And thanks so much f
Yep - you're right - missing parents are indicated as zero in the M/PID field.
The above code worked with a few errors:
1: In l$PID[l$Relationship == "sibling"] <- l$Sample.ID[father] :
number of items to replace is not a multiple of replacement length
2: In l$PID[l$Relationship == "sibling"] <
Actually - I didn't check this before, but these are not all nuclear
families (as I assumed they were). That is, some don't have a father
or don't have a mother Usually if this is the case PID or MID will
become 0, respectively, for the child. How can the code be edit to
account for this?
On
Thanks!
I think I know what is being done here but not sure how to fix the
following error:
Error in l$PID[l$\Relationship == "sibling"] <- l$Sample.ID[father] :
replacement has length zero
On Sat, Aug 16, 2014 at 6:48 PM, Jorge I Velez wrote:
> Dear Kate,
>
> Assuming you have nuclear fami
Dear Kate,
Assuming you have nuclear families, one option would be:
x <- read.table(textConnection("Family.ID Sample.ID Relationship
14 62 sibling
14 94 father
14 63 sibling
14 59 mother
17 6004 father
17 6003 mother
17 6005 s
Hi,
I have a data.table question (as well as if else statement query).
I have a large list of families (file has 935 individuals that are
sorted by famiy of varying sizes). At the moment the file has the
columns:
SampleID FamilyID Relationship
To prevent from having to make a pedigree file by
10 matches
Mail list logo