{ tol <- 1e-6 ; T }
{
#model.frame.default
is.data.frame(model.frame.default(Kyphosis~Age,data=kyphosis))
}
{
#model.frame.lm
free.lm <- lm(freeny.y~freeny.x)
is.data.frame(model.frame.lm(free.lm))
}
{
#model.frame.loess
etha.lo <- loess(NOx ~ C * E, span = 1/2, degree = 2, data=ethanol)
is.data.frame(model.frame.loess(etha.lo))
}
{
#model.frame.tree            # Support for tree()
T
}
{
#model.matrix
the.terms <- terms(pigment)
is.matrix(model.matrix(the.terms,pigment))
}
{
#model.xframe                # Support for Function preplot.gam()
T
}
{
#move.frame
n <- new.frame()
as.logical(move.frame(n))
}
{
#ms
ex.x<-c(1.0857,0.8863,0.9868,0.0877,0.7877,1.0886,0.9877,0.8883,1.0880,0.7877)
ex.y <- 1 + 2*exp(-ex.x)
ex.frame <<- data.frame( x=ex.x, y=ex.y)
parameters( ex.frame ) <- list( p1 = 0, p2 = 0, p3 = 0)
ex.ms <<- ms( ~ (p1 + p2*exp(x*p3) - y)^2, ex.frame)
any(names(ex.ms) == "parameters")
}
{
#ms.control
length(names(ms.control())) != 0
}
{
#profile.ms
class(profile.ms(ex.ms,data = ex.frame, which=1, npoints=1))[1] == "profile.ms"
}
{
#coef.mf
coeff <- coef.ms(ex.ms)
length(coeff) == 3
}
{
#mstree
i <- rbind(iris[,,1], iris[,,2], iris[,,3])
tree <- mstree(i)
any(names(tree)=="mst")
}
{
#na.fail
is.data.frame(na.fail(pigment))
}
{
#na.gam.replace
replaced.data <- na.gam.replace(claims)
is.data.frame(replaced.data)
}
{
#na.include
xna <- factor(c(1,2,3,1,2,3,2,3,1,2,3,NA,1,2,NA,2),labels=c("dog","cat","rat"))
lev.xna <- levels(na.include(xna))
length(lev.xna)==4
}
{
#na.omit
all(!is.na(na.omit(claims)))
}
{
#na.tree.replace.all (formerly na.tree.replace)
replaced.data <- na.tree.replace.all(claims)
is.data.frame(replaced.data)
}
{
#name.dots                    # Support for Function hist.tree()
T
}
{
#names
any(names(ozone.xy)=="x")
}
{
#names<-
names(ozone.xy) <- c("one","two")
any(names(ozone.xy)=="one")
}
{
#napsack
state.area <- state.x77[,"Area"]
state.half <- napsack(state.area, sum(state.area)/2)
is.logical(state.half)
}
{
#nargs
myfun <- function(..., a=4) nargs()
as.logical(myfun("bear"))
}
{
#nchar
nchar("this.is.a.long.word") == 19
}
{
#ncol
ncol(freeny.x)==4
}
{
#new.frame                   # Tested above with move.frame()
T
}
{
#nlmin
func <- function(x) {x^2-2*x+4}
min.func <- nlmin(func,0)
min.func$converged
}
{
#nls
#ex.x <- c(1.0857,0.8863,0.9868,0.0877,0.7877,1.0886,0.9877,0.8883,1.0880,0.7877)
#ex.y <- 1 + 2*exp(-ex.x)
#ex.frame <- data.frame( x=ex.x, y=ex.y )
#parameters( ex.frame ) <- list( p1 = 2, p2 = 1, p3 = -2)
#ex.nls <- nls( y ~ p1 + p2*exp(x*p3), ex.frame)
#any(names(ex.nls) == "parameters")
T
}
{
#nls.control
nls.control()$max.iters == 50
length(names(nls.control())) != 0
}
{
#coef.nls
#coeff <- coef.nls(ex.nls)
#length(coeff)==3
T
}
{
#profile.nls
#ex.prof <- profile.nls(ex.nls,data=ex.frame)
#class(ex.prof)[1]=="profile.nls"
T
}
{
#node.match                  # Support for tree functions
T
}
{
#nrow
nrow(freeny.x)==39
}
{
#ns
free.ns <- ns(freeny.y,5)
length(attributes(free.ns)[["knots"]])==12
}
{
#null
x <- null()
is.null(x)
}
{
#numeric
x <- numeric(5)
length(x) == 5
}
{
#oa.design
oa <- oa.design(c(2,3,3))
class(oa)[1] == "design"
}
{
#object.size
object.size(lynx)>0
}
{
#objects
is.character(objects(2))
}
{
#odometer
odometer(c(2, 1, 3), c(3, 3, 5))[1]  == 0
}
{
#offset                      # Support for Function formula()
exists("offset", mode="function")
}
{
#old2newNA           
if(platform() == "DOS386") TRUE 
else
platform()=="WIN386" || exists("old2newNA", mode="function")
}
{
#on.exit
f <- function()
{
        assign("crap", 1, frame = 0)
        on.exit(remove("crap", frame = 0))
        invisible()
}
f()
! exists("crap", frame=0)
}
{
#options
mode(options()$show) == "logical"
}
{
#order
x <- 1:5
all(order(x)==x)
}
{
#ordered
xfac <- factor(c(1,2,1,2,2,1,1,1,2,2,1),labels=c("good","better"))
xfac <- ordered(xfac)
class(xfac)[1] == "ordered"
}
{
#ordered<-
#ordered<-.default
ordered(xfac) <- c("better","good")
class(xfac)[2] == "factor"
}
{
#ordered<-.data.frame
xdf <- data.frame(one=factor(c(1,2,1,2,2,1,1,1,2,2,1),labels=c("good","better"))                 ,two=factor(c(1,2,1,2,1,2,1,2,2,1,2),labels=c("hot","cold")))
ordered(xdf)<-list(c("good","better"),c("cold","hot"))
class(xdf[[1]])[1]=="ordered"
}
{
#outer
all(dim(outer(1:3,3:1))==c(3,3))
}
