R: Error in pedigree(id, momid, dadid, sex): object "id" not found
1
0
Entering edit mode
@saraaglantarek-22840
Last seen 4.1 years ago

Hi everyone! I'm having a problem with package kinship2 to conduct a pedigree analysis, and I found nothing about it on google. I get this error trying to run this command:

ped2 <- with(pedigree(id, momid, dadid, sex))

Error in pedigree(id, momid, dadid, sex) : object 'id' not found

This is how my ped file look like:

famid id dadid momid sex pheno

EPBL-0001 0200356041 0200356061 0200356051 2 0

EPBL-0001 0200356051 0 0 2 0

EPBL-0001 0200356061 0 0 1 0

EPBL-0004 0200356071 0200356091 0200356081 2 0

EPBL-0004 0200356081 0 0 2 0

EPBL-0004 0200356091 0 0 1 0

Prior to this I run:

pedall <- pedigree(id= multisample_headers$id, dadid = multisample_headers$dadid, momid = multisample_headers$momid, sex= multisample_headers$sex, famid = multisample_headers$famid)

And it works telling me that the pedigree list contain 83 subjects in 28 families.

What's the problem with the id? Thank you in advance.

R kinship2 pedigree • 831 views
ADD COMMENT
0
Entering edit mode

.....................

ADD REPLY
0
Entering edit mode
shepherl 3.8k
@lshep
Last seen 2 hours ago
United States

I believe its looking for the id as a defined variable. id, momid, dadid, sex are arguments to the function and need to be defined; if there are not assigned variables the same name as those it will not be able to find it. Based on the other command you showed I would assume you would want to update the call to something

ped2 <- with(pedigree(id=multisample_headers$id, momid=multisample_headers$momid, dadid=multisample_headers$dadid, sex=multisample_headers$sex))

Or alternatively if you know you will be using those values multiple times, you could define them as variables

id=multisample_headers$id
momid=multisample_headers$momid
dadid=multisample_headers$dadid
sex=multisample_headers$sex)

# then this should work 
ped2 <- with(pedigree(id, momid, dadid, sex))
ADD COMMENT

Login before adding your answer.

Traffic: 954 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6