Re: [R] Advice on parsing formulae

2004-12-16 Thread Peter Dalgaard
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

Re: [R] Advice on parsing formulae

2004-12-16 Thread Gabor Grothendieck
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,

RE: [R] Advice on parsing formulae

2004-12-16 Thread Thomas Lumley
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

RE: [R] Advice on parsing formulae

2004-12-16 Thread Claus Dethlefsen
[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

RE: [R] Advice on parsing formulae

2004-12-16 Thread Heather Turner
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

Re: [R] Advice on parsing formulae

2004-12-15 Thread Heather Turner
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)),

Re: [R] Advice on parsing formulae

2004-12-14 Thread Chuck Berry
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