search for: prac2

Displaying 1 result from an estimated 1 matches for "prac2".

Did you mean: prack
2009 Jan 25
1
[Fwd: Re: evaluation question]
...m(wghts) # cleanup lapply( list(rep(1,10), rep(c(0.5, 1.5), 5)), function(wghts) p1(y~x)) # wghts found in e_g but obviously not this: rm(wghts) # cleanup lapply( list(rep(1,10), rep(c(0.5, 1.5), 5)), function(weights) p1(y~x)) # wghts not found > > # SOLUTION # 1 > > prac2 <- function( model,wghts){ > environment(model) <- environment() > lm(model,weights = wghts) > } > > prac2(model = y~x, wghts = rep(1, 10)) environment() returns the local call environment (see e_p1 above), where 'wghts' is mapped to a promise to evaluate rep(1,10) i...