You can return a list of them all
root <- function(var)
{
return(list(test1 = PP.test(var, lshort = T),
test2 = ...))
}
output <- root(var)
Then you can print them, save them, or whatever.
Or you could just print them out in the function
root <- function(var)
{
#---Phillips-Perron
print(PP.test(var, lshort = TRUE))
print(PP.test(var, lshort = FALSE))
.
.
.
}
Randy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Randy Johnson [Contr.]
Laboratory of Genomic Diversity |\
NCI Frederick ___lll__/| |\ ()
(301)846-1304 (_|||_)\| ()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea
Sent: Wednesday, October 13, 2004 1:20 PM
To: [EMAIL PROTECTED]
Subject: [R] incomplete function output
Dear R users,
I have a function (below) which encompasses several tests.
However, when I run it, only the output of the last test is
displayed. How can I ensure that the function root(var)
will run and display the output from all tests, and not
just the last one?
Thank you,
b.
root <- function(var)
{
#---Phillips-Perron
PP.test(var, lshort = TRUE)
PP.test(var, lshort = FALSE)
#---Augmented Dickey-Fuller
adf.test(var, alternative = "stationary", k =
trunc((length(var)-1)^(1/3)))
#---KPSS
kpss.test(var, null = "Level", lshort = TRUE)
kpss.test(var, null = "Trend", lshort = FALSE)
}
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html