Skip to content

Commit

Permalink
Minor updates suggested by lintr
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjie2wang committed Apr 11, 2024
1 parent 52e329e commit 7ab40d6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
15 changes: 7 additions & 8 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ splines2_default_options <- list(
)

## set options for splines2
.onLoad <- function(libname, pkgname)
{
op <- options()
toset <- ! names(splines2_default_options) %in% names(op)
if (any(toset)) {
options(splines2_default_options[toset])
}
invisible(NULL)
.onLoad <- function(libname, pkgname) {
op <- options()
toset <- ! names(splines2_default_options) %in% names(op)
if (any(toset)) {
options(splines2_default_options[toset])
}
invisible()
}
4 changes: 2 additions & 2 deletions inst/examples/ex-mSpline.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ intercept <- TRUE
internal_knots <- default_knots(x, df, intercept)

## 1. specify df
spline_basis1 = mSpline(x, degree = degree, df = df,
spline_basis1 <- mSpline(x, degree = degree, df = df,
periodic = TRUE, intercept = intercept)
## 2. specify knots
spline_basis2 = mSpline(x, degree = degree, knots = internal_knots,
spline_basis2 <- mSpline(x, degree = degree, knots = internal_knots,
periodic = TRUE, intercept = intercept)

all.equal(internal_knots, knots(spline_basis1))
Expand Down
2 changes: 1 addition & 1 deletion inst/examples/ex-naturalSpline.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fit1 <- lm(weight ~ -1 + nsk(height, df = 4, intercept = TRUE), data = women)
fit2 <- lm(weight ~ nsk(height, df = 3), data = women)

## the knots (same for both fits)
knots <- unlist(attributes(fit1$model[[2]])[c('Boundary.knots', 'knots')])
knots <- unlist(attributes(fit1$model[[2]])[c("Boundary.knots", "knots")])

## predictions at the knot points
predict(fit1, data.frame(height = sort(unname(knots))))
Expand Down
4 changes: 2 additions & 2 deletions man/mSpline.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/naturalSpline.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ab40d6

Please sign in to comment.