The R Project SVN R

Rev

Rev 86847 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 86847 Rev 87065
Line 102... Line 102...
102
foo <- proj(npk.aov)
102
foo <- proj(npk.aov)
103
cbind(npk, foo)
103
cbind(npk, foo)
104
## failed in R < 2.10.0
104
## failed in R < 2.10.0
105
 
105
 
106
 
106
 
107
if(suppressMessages(require("Matrix"))) {
107
if(suppressMessages(require("Matrix", .Library))) {
108
  print(cS. <- contr.SAS(5, sparse = TRUE))
108
  print(cS. <- contr.SAS(5, sparse = TRUE))
109
  stopifnot(all(contr.SAS(5) == cS.),
109
  stopifnot(all(contr.SAS(5) == cS.),
110
	    all(contr.helmert(5, sparse = TRUE) == contr.helmert(5)))
110
	    all(contr.helmert(5, sparse = TRUE) == contr.helmert(5)))
111
 
111
 
112
  x1 <- x2 <- c('a','b','a','b','c')
112
  x1 <- x2 <- c('a','b','a','b','c')
Line 129... Line 129...
129
print(xtabs(~ x1 + x2, exclude = 'c', na.action = na.pass))
129
print(xtabs(~ x1 + x2, exclude = 'c', na.action = na.pass))
130
 
130
 
131
 
131
 
132
## median should work by default for a suitable S4 class.
132
## median should work by default for a suitable S4 class.
133
## adapted from adaptsmoFMRI
133
## adapted from adaptsmoFMRI
134
if(suppressMessages(require("Matrix"))) {
134
if(suppressMessages(require("Matrix", .Library))) {
135
    x <- matrix(c(1,2,3,4))
135
    x <- matrix(c(1,2,3,4))
136
    print(m <- median(x))
136
    print(m <- median(x))
137
    stopifnot(all.equal(m, median(as(x, "denseMatrix"))))
137
    stopifnot(all.equal(m, median(as(x, "denseMatrix"))))
138
    detach("package:Matrix")
138
    detach("package:Matrix")
139
}
139
}
Line 167... Line 167...
167
    print(res <- alias(lm(Y ~ X1 + X2 + X3)))
167
    print(res <- alias(lm(Y ~ X1 + X2 + X3)))
168
    stopifnot(identical(rownames(res[[2]]), "X2"))
168
    stopifnot(identical(rownames(res[[2]]), "X2"))
169
}
169
}
170
## the error was in lm.(w)fit
170
## the error was in lm.(w)fit
171
 
171
 
172
if(require("Matrix")) {
172
if(require("Matrix", .Library)) {
173
 m1 <- m2 <- m <- matrix(1:12, 3,4)
173
 m1 <- m2 <- m <- matrix(1:12, 3,4)
174
 dimnames(m2) <- list(LETTERS[1:3],
174
 dimnames(m2) <- list(LETTERS[1:3],
175
                      letters[1:4])
175
                      letters[1:4])
176
 dimnames(m1) <- list(NULL,letters[1:4])
176
 dimnames(m1) <- list(NULL,letters[1:4])
177
 M  <- Matrix(m)
177
 M  <- Matrix(m)
Line 275... Line 275...
275
    desc$URL <- paste(URL1 <- "https://example.org",
275
    desc$URL <- paste(URL1 <- "https://example.org",
276
                      "https://example.com", sep = "\n") # via continuation line
276
                      "https://example.com", sep = "\n") # via continuation line
277
    desc$Repository <- NULL
277
    desc$Repository <- NULL
278
    c3 <- citation(auto = desc)
278
    c3 <- citation(auto = desc)
279
    stopifnot(identical(print(c3$url), URL1)) # R <= 4.4.0 gave both URLs
279
    stopifnot(identical(print(c3$url), URL1)) # R <= 4.4.0 gave both URLs
-
 
280
 
-
 
281
    unloadNamespace(pkg)
280
})
282
})
281
 
283
 
-
 
284
 
-
 
285
 
282
cat('Time elapsed: ', proc.time(),'\n')
286
cat('Time elapsed: ', proc.time(),'\n')