@@ -96,6 +96,7 @@ ct_scale <- new_generic("ct_scale", c("x", "t"))
9696
9797# ' @importFrom dplyr mutate
9898method(ct_scale , list (PointFrame , class_numeric )) <- \(x , t ) {
99+ stopifnot(length(t ) == 2 , is.finite(t ))
99100 y <- NULL # R CMD check
100101 x @ data <- x @ data | >
101102 mutate(x = x * t [1 ]) | >
@@ -107,6 +108,7 @@ method(ct_scale, list(PointFrame, class_numeric)) <- \(x, t) {
107108# could fix, but unclear what's expected.
108109# ' @importFrom sfarrow read_sf_dataset
109110method(ct_scale , list (ShapeFrame , class_numeric )) <- \(x , t ) {
111+ stopifnot(length(t ) == 2 , is.finite(t ))
110112 x @ data <- read_sf_dataset(x @ data )
111113 x @ data $ geometry <- x @ data $ geometry * t(t )
112114 return (x )
@@ -124,6 +126,7 @@ ct_rotate <- new_generic("ct_rotate", c("x", "t"))
124126
125127# ' @importFrom dplyr mutate select
126128method(ct_rotate , list (PointFrame , class_numeric )) <- \(x , t ) {
129+ stopifnot(length(t ) == 1 , is.finite(t ))
127130 y <- .y <- .x <- NULL # R CMD check
128131 R <- .R(t * pi / 180 )
129132 x @ data <- x @ data | >
@@ -137,6 +140,7 @@ method(ct_rotate, list(PointFrame, class_numeric)) <- \(x, t) {
137140
138141# ' @importFrom sfarrow read_sf_dataset
139142method(ct_rotate , list (ShapeFrame , class_numeric )) <- \(x , t ) {
143+ stopifnot(length(t ) == 1 , is.finite(t ))
140144 R <- .R(t * pi / 180 )
141145 x @ data <- read_sf_dataset(x @ data )
142146 x @ data $ geometry <- x @ data $ geometry * R
0 commit comments