Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recipes 1.1.0 will work work sf objects #52

Closed
EmilHvitfeldt opened this issue Jun 10, 2024 · 2 comments
Closed

recipes 1.1.0 will work work sf objects #52

EmilHvitfeldt opened this issue Jun 10, 2024 · 2 comments

Comments

@EmilHvitfeldt
Copy link
Contributor

In the upcoming recipes release you will be able to pass in a sf object without error.
Release tracked with tidymodels/recipes#1342.

I just wanted to let you know since I know that {tidysdm} works on such problems.

library(spatialsample)
library(recipes)

boston_canopy
#> Simple feature collection with 682 features and 18 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 739826.9 ymin: 2908294 xmax: 812069.7 ymax: 2970073
#> Projected CRS: NAD83 / Massachusetts Mainland (ftUS)
#> # A tibble: 682 × 19
#>    grid_id land_area canopy_gain canopy_loss canopy_no_change canopy_area_2014
#>    <chr>       <dbl>       <dbl>       <dbl>            <dbl>            <dbl>
#>  1 AB-4      795045.      15323.       3126.           53676.           56802.
#>  2 I-33      265813.       8849.      11795.           78677.           90472.
#>  3 AO-9      270153        6187.       1184.           26930.           28114.
#>  4 H-10     2691490.      73098.      80362.          345823.          426185.
#>  5 V-7       107890.        219.       3612.             240.            3852.
#>  6 Q-22     2648089.     122211.     154236.         1026632.         1180868.
#>  7 X-4       848558.       8275.       1760.            6872.            8632.
#>  8 P-18     2690726.     110928.     113146.          915137.         1028283.
#>  9 J-29     2574479.      38069.      15530.         2388638.         2404168.
#> 10 G-28     2641525.      87024.      39246.         1202528.         1241774.
#> # ℹ 672 more rows
#> # ℹ 13 more variables: canopy_area_2019 <dbl>, change_canopy_area <dbl>,
#> #   change_canopy_percentage <dbl>, canopy_percentage_2014 <dbl>,
#> #   canopy_percentage_2019 <dbl>, change_canopy_absolute <dbl>,
#> #   mean_temp_morning <dbl>, mean_temp_evening <dbl>, mean_temp <dbl>,
#> #   mean_heat_index_morning <dbl>, mean_heat_index_evening <dbl>,
#> #   mean_heat_index <dbl>, geometry <MULTIPOLYGON [US_survey_foot]>

recipe(land_area ~ ., data = boston_canopy)
#> 
#> ── Recipe ──────────────────────────────────────────────────────────────────────
#> 
#> ── Inputs
#> Number of variables by role
#> outcome:    1
#> predictor: 18
@dramanica
Copy link
Member

Thanks @EmilHvitfeldt, I'll have a thorough test with the RC for {recipes}, and then submit an updated version to CRAN early next week.

@dramanica
Copy link
Member

@EmilHvitfeldt this is fixed in the new version now on CRAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants