[GenABEL-dev] descriptives.traits by.var bugs.
pirastu at burlo.trieste.it
pirastu at burlo.trieste.it
Mon Mar 7 21:21:04 CET 2011
I've just looked at the problem
[#1259] descriptives.trait with by.var argument does not work
here's the problem he's had : descriptives.trait(data=test, by = bt)
and it's the same you mentioned about sex, so actually it does fix it.
Best
Nicola
> Nicola,
>
> many thanks for this!
>
> Questions: we have few 'by.var' args bugs filed in at
>
> https://r-forge.r-project.org/search/?type_of_search=full&group_id=505&atid=0&words=by.var&Search=Search
>
> I think your suggestions take direct care of
>
> [#1185] descriptives.trait with missings in by.var argument
> [#1184] descriptives.trait can not see the variable in by.var argument
> unless full path specified
>
> correct?
>
> did you try to see if it would address
>
> [#1259] descriptives.trait with by.var argument does not work
> (contributed by Richard Ahn)
>
> as well?
>
> best wishes, and thanks a lot!
>
> Yurii
>
>
> On Mon, Mar 7, 2011 at 2:36 PM, <pirastu at burlo.trieste.it> wrote:
>> Dear all,
>>
>> I'm new to the group so I'm not sure I'm doing this correctly, so if I'm
>> not please tell me so.
>> Anyways I think I found how to fix the problems with
>> descriptives.traits:
>>
>> 1) descriptives.trait with missings in by.var argument
>>
>> this line is causing the problem
>>
>> if (!is.numeric(ctrao) | all(ctrao == svar))
>>
>> it should be like this:
>>
>> if (!is.numeric(ctrao) | all(ctrao == svar,na.rm=T))
>>
>>
>> 2) descriptives.trait can not see the variable in by.var argument
>> unless
>> full path specified.
>>
>> the line
>> svar <- by.var
>>
>> and could be modified with these 3 lines:
>>
>> if(is.character(by.var) & length(by.var)==1){ svar <- data[,by.var]} #in
>> this case by.var should be specified as ie. "sex"
>>
>> if(is.vector(by.var)){ svar <- by.var }# in this case by.var should be
>> like phdata(ge03d2ex)$sex
>>
>> if(is.formula(by.var)){ svar <- data[,as.character(by.var)[2]]} #in this
>> case by.var should have the form ie. ~sex
>>
>>
>> I hope I could be of help. Sorry if I did not do things the right way.
>>
>> Best
>>
>> Nicola
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> genabel-devel mailing list
>> genabel-devel at lists.r-forge.r-project.org
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/genabel-devel
>>
>
More information about the genabel-devel
mailing list