Displaying 1 result from an estimated 1 matches for "prac_".
Did you mean:
prack
2009 Jan 25
1
[Fwd: Re: evaluation question]
...o include a variable named 'model' or
'wghts':
model = 1:10
prac2(y~model, rep(1,10))
# can't use model in a formula?
wghts = x
prac2(y~wghts, rep(1,10))
# oops, not quite the same prac2(y~x, rep(1,10))
another problem with this 'elegant' 'solution' is that if prac_ happens to have
local variables with names in conflict with names in the model formula, you're
in trouble again:
prac2 = function(model, wghts) {
environment(model) = environment()
x = NULL # for whatever reason one might need an x here
# whatever
lm(model, weights = wghts) }...