Displaying 3 results from an estimated 3 matches for "tst4".
Did you mean:
tst
2010 Oct 07
2
Testing for existence of object within a function
I'm trying to test for the existence of an object within a function,
but despite searching the help files and R-list, I can't figure out
how to do it.
Here is some test code:
#-------------------------
a=1 #now I have a in the global environment
tst <- function(a,b=1) {
# but a is not in the local function environment
print(exists("a", inherits=FALSE)) #This is how I think
2007 May 24
4
Function to Sort and test AIC for mixed model lme?
Hi List
I'm running a series of mixed models using lme, and I wonder if there
is a way to sort them by AIC prior to testing using anova
(lme1,lme2,lme3,....lme7) other than by hand.
My current output looks like this.
anova
(lme.T97NULL.ml,lme.T97FULL.ml,lme.T97NOINT.ml,lme.T972way.ml,lme.T97fc.
ml, lme.T97ns.ml, lme.T97min.ml)
Model df AIC BIC logLik
1997 Aug 25
0
R-alpha: Re: .Options$digits do not (always) work
...***************************************
R> tst3 <- function(x=pi, dig =3) {
+ oo <- options(digits=dig); on.exit(options(oo));
+ print(c(.Options$digits, options()$digits)); print(x); x }
R> tst3()
[1] 5 3
[1] 3.1416
[1] 3.1416
R> tst3(dig = 12)
[1] 5 12
[1] 3.1416
[1] 3.1416
R> tst4 <- function(x=pi, dig =3) {
+ .Options$digits <- dig;
+ print(c(.Options$digits, options()$digits)); print(x); x }
R> tst4()
[1] 3 7
[1] 3.1416
[1] 3.1416
***********************************************************************
SUMMARY: If we assign explicitly to .Options$digits in .Globa...