Skip to content

Commit cb7e81f

Browse files
committed
Deal with par issue
1 parent 5e8c6cd commit cb7e81f

Some content is hidden

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

70 files changed

+734
-763
lines changed

DESCRIPTION

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ Package: fda
22
Version: 6.0.5
33
Date: 2022-07-2
44
Title: Functional Data Analysis
5-
Author: J. O. Ramsay <ramsay@psych.mcgill.ca> [aut,cre],
6-
Spencer Graves <spencer.graves@effectivedefense.org> [ctb],
7-
Giles Hooker <gjh27@cornell.edu> [ctb]
5+
Authors@R: c(person("James", "Ramsay",
6+
role=c("aut","cre"),
7+
email="james.ramsay@mcgill.ca"),
8+
person("Giles", "Hooker",)
9+
role="ctb",
10+
email="gjh27@cornell.edu"),
11+
person("Spencer, "Graves",
12+
role="ctb",
13+
email="spencer.graves@effectivedefense.org"))
814
Maintainer: J. O. Ramsay <ramsay@psych.mcgill.ca>
915
Depends: R (>= 3.5), splines, fds, deSolve
1016
Suggests:

R/smooth.morph.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ smooth.morph <- function(x, y, ylim, WfdPar,
4343
# last modified 3 June 2022 by Jim Ramsay
4444

4545
nobs <- length(x) # number of observations
46-
wt=matrix(1,nobs,1)
46+
wt <- matrix(1,nobs,1)
4747
wt[nobs] <- 10
4848

4949
# check consistency of x and y and convert to column matrices
@@ -103,8 +103,11 @@ smooth.morph <- function(x, y, ylim, WfdPar,
103103

104104
# check range of x
105105

106-
if (x[1] < xlim[1] || x[nobs] > xlim[2]) {
107-
stop("Values in x are out of bounds.")
106+
if (abs(x[1] - xlim[1]) > 1e-7 || abs(x[nobs] - xlim[2]) > 1e-7) {
107+
stop("Values in x are out of bounds by more than 1e-7")
108+
} else {
109+
x[1 ] <- xlim[1]
110+
x[nobs] <- xlim[2]
108111
}
109112

110113
# initialize matrix Kmat defining penalty term

man/Data2fd.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ b1.1 <- create.bspline.basis(nbasis=1, norder=1)
269269
y12 <- 1:2
270270
# smooth data, giving a constant function with value 1.5
271271
fd1.1 <- Data2fd(y12, basisobj=b1.1)
272+
oldpar <- par(no.readonly=TRUE)
272273
plot(fd1.1)
273274
# now repeat the analysis with some smoothing, which moves the
274275
# toward 0.
@@ -401,5 +402,6 @@ AmRevLin.ct <- as.numeric(AmRevYrs.ct-AmRev.ct[1])
401402
AmRevYrs.ct <- as.numeric(AmRevYrs.ct)/rescale
402403
AmRevLin.ct <- as.numeric(AmRevLin.ct)/rescale
403404
fitLin.ct <- Data2fd(AmRevYrs.ct, AmRevLin.ct, BspRev.ct)
405+
par(oldpar)
404406
}
405407
\keyword{smooth}

man/Fperm.fd.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ Fperm.fd(yfdPar, xfdlist, betalist, wt=NULL, nperm=200,
134134
\code{\link{Fstat.fd}}
135135
}
136136
\examples{
137+
oldpar <- par(no.readonly=TRUE)
137138
##
138139
## 1. yfdPar = vector
139140
##
@@ -216,6 +217,7 @@ betalist = list(fdPar(hgtbasis,2,1e-6),fdPar(hgtbasis,2,1e-6))
216217
# Should use nperm = 200 or so,
217218
# but use 10 to save test time
218219
Fres = Fperm.fd(hgtfd,xfdlist,betalist,nperm=10)
220+
par(oldpar)
219221
}
220222

221223
}

man/Lfd.Rd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,4 @@ bfdobj <- fd(Lcoef,Lbasis)
7373
bwtlist <- fd2list(bfdobj)
7474
harmaccelLfd <- Lfd(3, bwtlist)
7575
}
76-
% docclass is function
7776
\keyword{smooth}

man/StatSciChinese.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
95, 9-15.
3434
}
3535
\examples{
36+
oldpar <- par(no.readonly=TRUE)
3637
data(StatSciChinese)
3738

3839
i <- 3
@@ -48,5 +49,6 @@ plot(StatSci1[, 1:2], type='l')
4849

4950
mark <- seq(1, 601, 12)
5051
points(StatSci1[mark, 1], StatSci1[mark, 2])
52+
par(oldpar)
5153
}
5254
\keyword{datasets}

man/arithmetic.fd.Rd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ times.fd(e1, e2, basisobj=NULL)
6868
\code{\link{exponentiate.fd}}
6969
}
7070
\examples{
71+
oldpar <- par(no.readonly=TRUE)
7172
##
7273
## add a parabola to itself
7374
##
@@ -165,6 +166,9 @@ all.equal(coef(-parab4.5), coefneg)
165166
plot(parab4.5-1)
166167
167168
plot(1-parab4.5)
169+
170+
par(oldpar)
171+
168172
}
169173
\keyword{smooth}
170174

man/as.fd.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ fdx. <- eval.fd(x., fd.)
9292

9393
rfdx <- range(fdx.)
9494

95+
oldpar <- par(no.readonly= TRUE)
9596
plot(range(x2), range(y2, fx., rfdx), type='n')
9697
points(x2, y2)
9798
lines(x., sin((x.-0.5)*pi), lty='dashed')
@@ -130,6 +131,7 @@ lines(cars.spl)
130131
sp. <- with(cars, seq(min(speed), max(speed), len=101))
131132
d. <- eval.fd(sp., cars.fd)
132133
lines(sp., d., lty=2, col='red', lwd=3)
134+
par(oldpar)
133135
}
134136
\keyword{smooth}
135137
\keyword{manip}

man/axisIntervals.Rd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ axesIntervals(side=1:2, atTick1=fda::monthBegin.5, atTick2=fda::monthEnd.5,
8282
\code{\link{monthLetters}}
8383
}
8484
\examples{
85+
oldpar <- par(no.readonly= TRUE)
8586
daybasis65 <- create.fourier.basis(c(0, 365), 65)
8687

8788
daytempfd <- with(CanadianWeather, smooth.basis(
@@ -109,7 +110,7 @@ axesIntervals()
109110

110111
axisIntervals(3, labels=monthLetters, cex.lab=1.2, line=-0.5)
111112
# 'line' argument here is passed to 'axis' via '...'
112-
113+
par(oldpar)
113114
}
114115
% docclass is function
115116
\keyword{smooth}

man/cca.fd.Rd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ round(ccafd0$ccacorr[1:6],3)
8888
# compute a VARIMAX rotation of the canonical variables
8989
ccafd <- varmx.cca.fd(ccafd0)
9090
# plot the canonical weight functions
91+
oldpar <- par(no.readonly= TRUE)
9192
plot.cca.fd(ccafd)
93+
par(oldpar)
94+
9295
}
9396
\keyword{smooth}

0 commit comments

Comments
 (0)