Bonjour Chers tous,
J’ai probleme avec la fonction pivot_longer,
voici mon code :
pacman::p_load(
here,
rio,
lubridate,
janitor,
ggplot2,
flextable,
tidyverse
)
database_wb <- import(here("data","countries.xlsx"))
database_wb %>% pivot_longer(
cols = 2019:2022,
names_to="year",
values_to="values_nbr"
)
J’ai un message d’erreur :
Error in
loc_validate()
:
! Can’t subset columns past the end.
Locations 2019, 2020, 2021, and 2022 don’t exist.
There are only 5 columns.
Mon DataFrame :