i cant arrange the coloum season_month

    mutate(season_month = case_when(
    month == "1" | month == "2" | month =="12" ~ "winter",
    month == "3"| month == "4" | month=="5" ~ "spring",
    month =="6" | month == "7" | month =="8" ~ "summer",
    month =="11"|month =="10"| month =="9"~"autumn"))%>%

i have been told that i need to use arrange as a call back but when i do it comes back as an error with it saying season_month column doesnt exist

Always start by seeing what is in the source data.

rodents_full <- readr::read_tsv("https://bit.ly/rodents_full")
#> Rows: 34786 Columns: 13
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: "\t"
#> chr (6): species_id, sex, genus, species, taxa, plot_type
#> dbl (7): record_id, month, day, year, plot_id, hindfoot_length, weight
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#>  [1] "record_id"       "month"           "day"             "year"           
#>  [5] "plot_id"         "species_id"      "sex"             "hindfoot_length"
#>  [9] "weight"          "genus"           "species"         "taxa"           
#> [13] "plot_type"

If you move the select() call to the end it works. You ask it to select season_month before it has done the necessary mutate()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.