Skip to content

Commit 7c4c7ff

Browse files
committed
fix conflict
2 parents aa88ce6 + 925e030 commit 7c4c7ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+7277
-6116
lines changed

CHANGELOG

Whitespace-only changes.

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Author: J. O. Ramsay <ramsay@psych.mcgill.ca> [aut,cre],
66
Spencer Graves <spencer.graves@effectivedefense.org> [ctb],
77
Giles Hooker <gjh27@cornell.edu> [ctb]
88
Maintainer: J. O. Ramsay <ramsay@psych.mcgill.ca>
9-
Depends: R (>= 3.5)
10-
Suggests: deSolve, lattice
9+
Depends: R (>= 3.5), Matrix
10+
Suggests: deSolve, R.matlab, lattice
1111
Description: These functions were developed to support functional data
1212
analysis as described in Ramsay, J. O. and Silverman, B. W.
1313
(2005) Functional Data Analysis. New York: Springer and in

NAMESPACE

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export(AmpPhaseDecomp,
22
as.array3,
3+
as.fd,
34
as.POSIXct1970,
45
axisIntervals,
56
axesIntervals,
@@ -19,6 +20,7 @@ export(AmpPhaseDecomp,
1920
checkLogicalInteger,
2021
cor.fd,
2122
covPACE,
23+
CRAN,
2224
create.bspline.basis,
2325
create.constant.basis,
2426
create.exponential.basis,
@@ -52,14 +54,15 @@ export(AmpPhaseDecomp,
5254
exponpen,
5355
fd, fbplot,
5456
fd2list,
57+
fdaMatlabPath,
5558
fdlabels,
5659
fdPar,
5760
fourier,
5861
fourierpen,
5962
Fperm.fd,
6063
fRegress,
61-
fRegressCV,
62-
fRegressStderr,
64+
fRegress.CV,
65+
fRegress.stderr,
6366
Fstat.fd,
6467
geigen,
6568
getbasismatrix,
@@ -148,6 +151,7 @@ export(AmpPhaseDecomp,
148151
import("graphics")
149152
import("stats")
150153
import("splines")
154+
import("Matrix")
151155

152156
importFrom("grDevices", "dev.new", "heat.colors")
153157
importFrom("utils", "data")
@@ -198,6 +202,8 @@ S3method(fitted, monfd)
198202
S3method(residuals, monfd)
199203
S3method(predict, monfd)
200204
S3method(fRegress, numeric)
205+
S3method(fRegress, stderr)
206+
S3method(fRegress, CV)
201207
S3method(matplot, numeric)
202208
S3method(fitted, posfd)
203209
S3method(predict, posfd)

R/CRAN.R

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
CRAN <- function(CRAN_pattern, n_R_CHECK4CRAN){
2+
##
3+
## 1. get environment variables
4+
##
5+
gete <- Sys.getenv()
6+
ngete <- names(gete)
7+
i <- seq(along=gete)
8+
##
9+
## 2. check CRAN_pattern
10+
##
11+
if(missing(CRAN_pattern)){
12+
if('_CRAN_pattern_' %in% ngete){
13+
CRAN_pattern <- gete['_CRAN_pattern_']
14+
} else CRAN_pattern <- '^_R_'
15+
}
16+
##
17+
## 3. check n_R_CHECK4CRAN
18+
##
19+
if(missing(n_R_CHECK4CRAN)){
20+
if('_n_R_CHECK4CRAN_' %in% ngete){
21+
n_R_CHECK4CRAN <- as.numeric(gete['_n_R_CHECK4CRAN_'])
22+
} else n_R_CHECK4CRAN <- 5
23+
}
24+
##
25+
## 4. Check
26+
##
27+
for(pati in CRAN_pattern)
28+
i <- i[grep(pati, ngete[i])]
29+
##
30+
## 5. Done
31+
##
32+
cran. <- (length(i) >= n_R_CHECK4CRAN)
33+
attr(cran., 'Sys.getenv') <- gete
34+
attr(cran., 'matches') <- i
35+
cran.
36+
}
37+
38+

R/argcheck.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
argcheck = function(argvals) {
2+
3+
# check ARGVALS
4+
5+
if (!is.numeric(argvals)) stop("ARGVALS is not numeric.")
6+
7+
argvals <- as.vector(argvals)
8+
9+
if (length(argvals) < 2) stop("ARGVALS does not contain at least two values.")
10+
11+
return(argvals)
12+
13+
}
14+

R/bsplineS.R

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
1-
bsplineS <- function (x, breaks, norder=4, nderiv=0)
2-
{
3-
# This is a wrapper function for the S-PLUS spline.des function.
4-
# The number of spline functions is equal to the number of
5-
# discrete break points, length(BREAKVALUES), plus the order, NORDER,
6-
# minus 2.
7-
# Arguments are as follows:
8-
# X ... array of values at which the spline functions are to
9-
# evaluated
10-
# BREAKS ... a STRICTLY INCREASING sequence of break points or knot
11-
# values. It must contain all the values of X within its
12-
# range.
13-
# NORDER ... order of spline (1 more than degree), so that 1 gives a
14-
# step function, 2 gives triangle functions,
15-
# and 4 gives cubic splines
16-
# NDERIV ... highest order derivative. 0 means only function values
17-
# are returned.
18-
# Return is a matrix with length(X) rows and number of columns equal to
19-
# number of b-splines
20-
21-
# previously modified 6 January 2020 2012 by Jim Ramsay
22-
23-
x <- as.vector(x)
24-
n <- length(x)
25-
tol <- 1e-14
26-
nbreaks <- length(breaks)
27-
if (nbreaks < 2) stop('Number of knots less than 2.')
28-
if (min(diff(breaks)) < 0 ) stop('Knots are not increasing')
29-
30-
if ( max(x) > max(breaks) + tol ||
31-
min(x) < min(breaks) - tol )
32-
stop('Knots do not span the values of X')
33-
if ( x[n] > breaks[nbreaks]) breaks[nbreaks] <- x[n]
34-
if ( x[1] < breaks[1] ) breaks[1] <- x[1]
35-
36-
if (norder > 20) stop('NORDER exceeds 20.')
37-
if (norder < 1) stop('NORDER less than 1.')
38-
if (nderiv > 19) stop('NDERIV exceeds 19.')
39-
if (nderiv < 0) stop('NDERIV is negative.')
40-
if (nderiv >= norder) stop (
41-
'NDERIV cannot be as large as order of B-spline.')
42-
43-
knots <- c(rep(breaks[1 ],norder-1), breaks,
44-
rep(breaks[nbreaks],norder-1) )
45-
derivs <- rep(nderiv,n)
46-
nbasis <- nbreaks + norder - 2
47-
if (nbasis >= norder) {
48-
if (nbasis > 1) {
49-
basismat <- spline.des(knots, x, norder, derivs)$design
50-
} else {
51-
basismat <- as.matrix(spline.des(knots, x, norder, derivs)$design)
52-
}
53-
if(length(dim(basismat)) == 2){
54-
return(as.matrix(basismat))
55-
}
56-
return(basismat)
57-
} else {
58-
stop("NBASIS is less than NORDER.")
59-
}
60-
}
1+
bsplineS <- function (x, breaks, norder=4, nderiv=0, returnMatrix=FALSE)
2+
{
3+
# This is a wrapper function for the S-PLUS spline.des function.
4+
# The number of spline functions is equal to the number of
5+
# discrete break points, length(BREAKVALUES), plus the order, NORDER,
6+
# minus 2.
7+
# Arguments are as follows:
8+
# X ... array of values at which the spline functions are to
9+
# evaluated
10+
# BREAKS ... a STRICTLY INCREASING sequence of break points or knot
11+
# values. It must contain all the values of X within its
12+
# range.
13+
# NORDER ... order of spline (1 more than degree), so that 1 gives a
14+
# step function, 2 gives triangle functions,
15+
# and 4 gives cubic splines
16+
# NDERIV ... highest order derivative. 0 means only function values
17+
# are returned.
18+
# Return is a matrix with length(X) rows and number of columns equal to
19+
# number of b-splines
20+
21+
# last modified 6 May 2012 by Spencer Graves
22+
# previously modified 2 April 2012 by Jim Ramsay
23+
24+
x <- as.vector(x)
25+
n <- length(x)
26+
tol <- 1e-14
27+
nbreaks <- length(breaks)
28+
if (nbreaks < 2) stop('Number of knots less than 2.')
29+
if (min(diff(breaks)) < 0 ) stop('Knots are not increasing')
30+
31+
if ( max(x) > max(breaks) + tol ||
32+
min(x) < min(breaks) - tol )
33+
stop('Knots do not span the values of X')
34+
if ( x[n] > breaks[nbreaks]) breaks[nbreaks] <- x[n]
35+
if ( x[1] < breaks[1] ) breaks[1] <- x[1]
36+
37+
if (norder > 20) stop('NORDER exceeds 20.')
38+
if (norder < 1) stop('NORDER less than 1.')
39+
if (nderiv > 19) stop('NDERIV exceeds 19.')
40+
if (nderiv < 0) stop('NDERIV is negative.')
41+
if (nderiv >= norder) stop (
42+
'NDERIV cannot be as large as order of B-spline.')
43+
44+
knots <- c(rep(breaks[1 ],norder-1), breaks,
45+
rep(breaks[nbreaks],norder-1) )
46+
derivs <- rep(nderiv,n)
47+
nbasis <- nbreaks + norder - 2
48+
if (nbasis >= norder) {
49+
if (nbasis > 1) {
50+
basismat <- Matrix(spline.des(knots, x, norder, derivs)$design)
51+
} else {
52+
basismat <- as.matrix(spline.des(knots, x, norder, derivs)$design)
53+
}
54+
if((!returnMatrix) && (length(dim(basismat)) == 2)){
55+
return(as.matrix(basismat))
56+
}
57+
return(basismat)
58+
} else {
59+
stop("NBASIS is less than NORDER.")
60+
}
61+
}

0 commit comments

Comments
 (0)