Claus Dethlefsen [EMAIL PROTECTED] writes:
Thank you for the advice. I have now boiled my problem down to the
following:
How do I create fm2 from fm1 ?
fm1 - Y ~ 1 + tvar(x:A) + tvar(z) + u + tvar(B) + tvar(poly(v,3))
fm2 - Y ~ 1 + x:A + z + u + B + poly(v, 3)
Thus, how do I simply
Claus Dethlefsen dethlef at math.aau.dk writes:
:
: Thank you for the advice. I have now boiled my problem down to the
: following:
:
: How do I create fm2 from fm1 ?
:
: fm1 - Y ~ 1 + tvar(x:A) + tvar(z) + u + tvar(B) + tvar(poly(v,3))
: fm2 - Y ~ 1 + x:A + z + u + B + poly(v, 3)
:
: Thus,
On Thu, 16 Dec 2004, Claus Dethlefsen wrote:
Thank you for the advice. I have now boiled my problem down to the
following:
How do I create fm2 from fm1 ?
fm1 - Y ~ 1 + tvar(x:A) + tvar(z) + u + tvar(B) + tvar(poly(v,3))
fm2 - Y ~ 1 + x:A + z + u + B + poly(v, 3)
Thus, how do I simply remove
[mailto:[EMAIL PROTECTED]
Sent: 15. december 2004 11:41
To: [EMAIL PROTECTED]
Subject: Re: [R] Advice on parsing formulae
I think this will do what you want:
# Need this function to remove spaces from term labels later on
removeSpace - function(string) gsub([[:space:]], , string
PROTECTED], [EMAIL PROTECTED]
Date: 12/16/04 8:33am
Subject:RE: [R] Advice on parsing formulae
Thank you for the advice. I have now boiled my problem down to the
following:
How do I create fm2 from fm1 ?
fm1 - Y ~ 1 + tvar(x:A) + tvar(z) + u + tvar(B) + tvar(poly(v,3))
fm2 - Y ~ 1 + x:A
I think this will do what you want:
# Need this function to remove spaces from term labels later on
removeSpace - function(string) gsub([[:space:]], , string)
# Specify which terms are in a tvar group
# (could remove spaces separately)
tvar - unname(sapply(c(x:A, z, B, poly(v,3)),
Claus Dethlefsen dethlef at math.aau.dk writes:
Dear list
I would like to be able to group terms in a formula using a function that I
will call tvar(), eg. the formula
Y ~ 1 + tvar(x:A) + tvar(z) + u + tvar(B) + tvar(poly(v,3))
where x,u and v are numeric and A and B are