File: test-plot.R

package info (click to toggle)
r-cran-splines2 0.5.4-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,020 kB
  • sloc: cpp: 3,232; sh: 13; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 725 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## test the $ method
x <- c(NA, seq.int(0, 0.5, 0.1), NA, seq.int(0.6, 1, 0.1), NA)
knots <- c(0.25, 0.5, 0.75)
b_knots <- c(0, 1)

## periodic = FALSE
res <- bSpline(x, df = 6)
plot(res, mark_knots = "none") # current default
plot(res, mark_knots = "internal")
plot(res, mark_knots = "boundary")
plot(res, mark_knots = "all")

## periodic = TRUE
res <- bSpline(c(x, 2 * x), df = 6, periodic = TRUE)
plot(res, mark_knots = "none") # current default
plot(res, mark_knots = "internal")
plot(res, mark_knots = "boundary")
plot(res, mark_knots = "all")

## test warning messages
x <- seq.int(- 1, 2, by = 0.1)
bs0 <- bsp(x, degree = 0, knots = 0.4, Boundary.knots = c(0, 1),
           intercept = TRUE)
expect_silent(plot(bs0))