I'm trying to pass a filtered dataframe onto a subsequent function. Consider Iris dataframe. I filter out only on Versicolor species and then I want to use Sepal.Length and Sepal.Width column into a function that takes two vectors. I'm currently trying to implement DouglasPeuckerNbPoints, so I will use this as an example
iris %>%
filter(
(Species == "versicolor"))
I have tried:
library(kmlShape)
iris %>%
filter(
(Species == "versicolor")) %>%
DouglasPeuckerNbPoints(.$Sepal.Length,.$Sepal.Width,20)
But this is giving me the error "Error in xy.coords(x, y, setLab = FALSE) : 'x' and 'y' lengths differ".
Any help here?