[GenABEL-dev] [Fwd: Re: descriptives.trait Patch]
pirastu at burlo.trieste.it
pirastu at burlo.trieste.it
Thu Mar 31 17:15:20 CEST 2011
Actually yes, its a trick I've used to eliminate the "". If you use ~ R
will interpeter as a formula and will not require quotes.
You can try to type something like a<-x~y, a will be of class formula.
you can actually make lists with more formulas.
a<- x~y
b<-f~d
c(a,b)
They will be taken by lm and other things.
That said this will work also with ~x for example.
If you do
as.character(a)
[1] "~" "x" "y"
basically I used this to avoid having the error " sex is not an object" or
something like that.
Also from a "formal" point of view it makes sense, in fact when you make a
boxplot for example you would type
boxplot(trait~sex)
to get a boxplot for each category.
I could infact change descriptives.trait to work in the same way,
something like
descriptives.trait(srdta~sex)
which might be a little more intuitive, but this solution was quicker at
least to implement.
Hope to have answered your questions.
Best
Nicola
>> I was looking at the documentation changes you made, and I just wanted
>> to
>> point out that another version of the command is:
>>
>> descriptives.trait(srdta, by.var=~sex)
>>
>> whithout "".
>
> I have noticed that type of passing an argument in your test-code, but
> thought of dropping this as I have no idea what this means. Looking
> for help("~") returned explanation for "~" as a part of formula.
>
> Do you know what this actually means and how it works?
>
> Yurii
>
More information about the genabel-devel
mailing list