Closed vojta-bartak closed 3 years ago
Can you provide a reproducible code example? For example, this works fine for me:
library(sf)
library(smoothr)
l <- st_sfc(st_linestring(matrix(c(0, 0.25, 1, 0, 0.75, 1), ncol = 2)))
s_ch <- smooth(l, method = "chaikin")
s_ks <- smooth(l, method = "ksmooth")
s_sp <- smooth(l, method = "spline")
plot(l)
plot(s_ch, col = "red", add = TRUE)
plot(s_ks, col = "blue", add = TRUE)
plot(s_sp, col = "green", add = TRUE)
It was my stupid mistake as I improperly used pipeline notation and repeated the object to be smoothed as an argument of smooth
, i.e. instead of line %>% smooth(method = ...)
I wrote line %>% smooth(line, method = ...)
. I apologize for stealing your time, I was just blind.
I'm trying to smooth a sf object with LINESTRING sfc (one single feature only), following the package vignette.
Error in smoother(m, wrap = all(m[1, ] == m[nrow(m), ]), ...) : is_count(refinements) is not TRUE
Error in smoother(m, wrap = all(m[1, ] == m[nrow(m), ]), ...) : is.numeric(smoothness) is not TRUE
Error in smoother(m, wrap = all(m[1, ] == m[nrow(m), ]), ...) : is.double(vertex_factor) is not TRUE
Am I doing anything wrong?
Thanks!