Hi Dominique,
the message is not an actual error. It is more of a reminder. It serves to remind you that your spatial objects are described in angular units (degrees), which is OK for a sphere, but you are drawing a chart that is flat.
Reconciling the flat chart vs round Earth dilemma is impossible, but generations of cartographers have come with some ingenious solutions.
There are multiple ways to project your data, and there is not (and can not be) one universally correct. Choosing one is always a tradeoff (are you more interested in accurate directions, or areas?) and in most cases follows a convention.
Most standard projections are catalogued by EPSG.io (originally European Petroleum Survey Group - the reference to oil industry makes the abbreviation easier to remember).
You can change the projection by piping your spatial object to sf::st_transform() function, with argument of the EPSG code.
The difference between projections is usually negligible in small areas (cities or so) but becomes an issue with country or continent sized areas of interest.
Because an example speaks more than a 1000 of words: consider the USA. The lower 48 are about the right size for a projection to matter. Plus it is an easily recognizable
library(sf)
library(tidyverse)
library(USAboundaries)
usa <- us_boundaries(type="state", resolution = "low") %>%
filter(!state_abbr %in% c("PR", "AK", "HI")) # lower 48 only
wgs84 <- usa %>%
st_transform(4326) # WGS84 - good default
albers <- usa %>%
st_transform(5070) # Albers - a popular choice for the lower 48
ggplot() +
geom_sf(data = wgs84, fill = NA)
ggplot() +
geom_sf(data = albers, fill = NA)
The WGS84 - always a good starting point, but has its shortcomings - draws all parallels as straight lines (watch the Canada border!). This makes the northern states - e.g. Montana - seem bigger than they actually are, compared to those closer to the equator - e.g. Florida. It also looks ugly.
The Albers conical projection is the most common projection for the lower 48. Parallels are not straight (again, watch the Canada border) but the size of the states is more accurate, and the map looks more natural.
To sum my rant up: choosing a "right" projection for your data may be hard, and will depend on your area of interest. Applying it will be easy - with sf::st_transform().