search for: tfun2

Displaying 5 results from an estimated 5 matches for "tfun2".

Did you mean: fun2
2016 Jul 27
2
Model object, when generated in a function, saves entire environment when saved
Another solution is to only save the parts of the model object that interest you. As long as they don't include the formula (which is what drags along the environment it was created in), you will save space. E.g., tfun2 <- function(subset) { junk <- 1:1e6 list(subset=subset, lm(Sepal.Length ~ Sepal.Width, data=iris, subset=subset)$coef) } saveSize(tfun2(1:4)) #[1] 152 Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Jul 27, 2016 at 11:19 AM, William Dunlap <wdunlap at tibco.com> wrote:...
2011 Aug 05
2
Which is more efficient?
Greetings all, I am curious to know if either of these two sets of code is more efficient? Example1: ## t-test ## colA <- temp [ , j ] colB <- temp [ , k ] ttr <- t.test ( colA, colB, var.equal=TRUE) tt_pvalue [ i ] <- ttr$p.value or Example2: tt_pvalue [ i ] <- t.test ( temp[ , j ], temp[ , k ], var.equal=TRUE) ------------- I have three loops, i, j, k. One to test the all of
2016 Jul 27
0
Model object, when generated in a function, saves entire environment when saved
...R-devel < r-devel at r-project.org> wrote: > Another solution is to only save the parts of the model object that > interest you. As long as they don't include the formula (which is > what drags along the environment it was created in), you will > save space. E.g., > > tfun2 <- function(subset) { > junk <- 1:1e6 > list(subset=subset, lm(Sepal.Length ~ Sepal.Width, data=iris, > subset=subset)$coef) > } > > saveSize(tfun2(1:4)) > #[1] 152 > > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Wed, Jul 27,...
2020 Jan 29
2
Model object, when generated in a function, saves entire environment when saved
...oject.org> wrote: > >> Another solution is to only save the parts of the model object that >> interest you. As long as they don't include the formula (which is >> what drags along the environment it was created in), you will >> save space. E.g., >> >> tfun2 <- function(subset) { >> junk <- 1:1e6 >> list(subset=subset, lm(Sepal.Length ~ Sepal.Width, data=iris, >> subset=subset)$coef) >> } >> >> saveSize(tfun2(1:4)) >> #[1] 152 >> >> >> >> Bill Dunlap >> TIBCO Software &...
2016 Jul 27
3
Model object, when generated in a function, saves entire environment when saved
In the below, I generate a model from an environment that isn't .GlobalEnv with a large object that is unrelated to the model generation. It seems to save the irrelevant object unnecessarily. In my actual use case, I am running and saving many models in a loop that each use a single large data.frame (that gets collapsed into a small data.frame for estimation), so removing it isn't an