Results of sanitary controls in France can be found on data.gouv.fr however, only the running year is available… Thanks to @cquest@amicale.net we can access the archives since 2017.
First a global view of the dataset :
About 800 controls per week, except during the lock-down in 2020, and a slightly lower control pressure in 2021 and 2022.
Poor results (To be improved or To be corrected urgently) are stable at around 6 %, except a recent spike in 2023?
It seems that poor results increase during the year, from June to November.
This surprising periodic phenomenon is also visible by day :
So for the « when », it is : not in summer or autumn.
What about the « where »? It seems you also could be careful in some départements…
Not good in Guadeloupe, Guyane, Réunion and the southern lower Seine valley, west of Paris.
Can we see more in details ? Using a 30 km kernel smoothing :
It confirms some hot-spots west of Paris, in Alsace, in Indre, Cher, Alpes-Maritimes and between Gironde and Landes. You are safer in Paris and Bretagne…
It’s cherry blossom time… A nice dataset going back to the year 812 in Japan can be found here. It describes the phenological data for full flowering date of cherry tree (Prunus jamasakura) in Kyoto, showing springtime climate changes.
This old post sees a little traffic from search engines but is a mess after many editions due to the packages evolutions.
So, how can we (chose your term) append, merge, union or combine many shapefiles or other spatial vector data in 2023 with R, preferably using tidyverse functions ?
For good measure, we want to add the source file as an attribute.
First, make some data using the geopackage available here. We generate several shapefiles (one per région) in a temporary directory :
dep <- sf::read_sf("~/data/adminexpress/adminexpress_cog_simpl_000_2022.gpkg",
layer = "departement")
dep |>
dplyr::group_by(insee_reg) |>
dplyr::group_walk(\(grp_data, grp_name) sf::write_sf(grp_data,
glue::glue("~/temp/reg_{grp_name}.shp")))
Recommended, as seen in the purrr help on map_dfr (that I liked better, see below) but verbose because we have to specify that we want a sf-tibble which is lost in translation.
library(tidyverse)
library(rnaturalearth)
library(spdep)
# get data from Natural Earth
countries <- ne_countries(scale = 10, returnclass = "sf") |>
st_make_valid() |>
group_by(sov_a3, sovereignt) |>
summarise(.groups = "drop")
# for joining codes and names later
lookup <- countries |>
st_drop_geometry()
# get neighbours with {spdep}
neighbours <- countries |>
poly2nb()
# we only keep countries with 1 neighbour
# and add names
neighbours |>
set_names(countries$sov_a3) |>
keep(\(x) length(x) == 1) |>
enframe("sov_a3", "nb") |>
unnest(nb) |>
filter(nb != 0) |>
mutate(nb = countries$sov_a3[nb]) |>
left_join(lookup, by = "sov_a3") |>
left_join(lookup, by = c("nb" = "sov_a3"), suffix = c("", "_nb")) |>
relocate(sovereignt, .after = 1)
# A tibble: 16 × 4
sov_a3 sovereignt nb sovereignt_nb
<chr> <chr> <chr> <chr>
1 BRN Brunei MYS Malaysia
2 CAN Canada US1 United States of America
3 DN1 Denmark DEU Germany
4 DOM Dominican Republic HTI Haiti
5 GMB Gambia SEN Senegal
6 HTI Haiti DOM Dominican Republic
7 IRL Ireland GB1 United Kingdom
8 KOR South Korea PRK North Korea
9 LSO Lesotho ZAF South Africa
10 MCO Monaco FR1 France
11 PNG Papua New Guinea IDN Indonesia
12 PRT Portugal ESP Spain
13 QAT Qatar SAU Saudi Arabia
14 SMR San Marino ITA Italy
15 TLS East Timor IDN Indonesia
16 VAT Vatican ITA Italy
I miss Bahrain / Saudi Arabia because the Natural Earth dataset is not detailed enough…
# A tibble: 209 × 3
sov_a3 n sovereignt
<chr> <int> <chr>
1 CH1 15 China
2 RUS 14 Russia
3 BRA 11 Brazil
4 FR1 11 France
5 COD 9 Democratic Republic of the Congo
6 DEU 9 Germany
7 AUT 8 Austria
8 SDN 8 Sudan
9 SRB 8 Republic of Serbia
10 TUR 8 Turkey
# … with 199 more rows
However it includes the disputed part of « Kashmir », claimed by India and China, so it’s 14 neighbours, like Russia.
« a pair of cats can produce 20,000 individuals in just four years ».
(translation)
That seems quite high… Let’s check!
(additionally, the article is about feral cats preying on wildlife but we are shown a wild cat capturing a laboratory mouse!)
This figure could come from a back-of-the-envelope calculation, such as litters of 3.5 kitten twice a year for 4 years producing 3.58 ≈ 22,519 kitten. But that’s a very rough and false estimate : at this rate there will be 76 billions cats in Lyon in 10 years! Moreover we ignore the fact that the first generations can still have litters, the less than perfect survival of feral cats, the delay before the first pregnancy, etc.
We can use Leslie matrix to model the destiny of our founding pair. Leslie matrices are used in population ecology to project a structured (by age) population based on transitions between age classes and fertility.
Cat females reach sexual maturity at 6–8 months (Kaeuffer et al. 2004), can have 2.1 litters each year (Robinson & Cox, 1970) and have a mean of around 4 kitten by litter (Hall & Pierce, 1934 ; Deag et al., 1987) or 9.1 kitten by year (Robinson & Cox, 1970). So we will use quarters as ages classes. We first use an unrealistic 100 % survival and 100 % fecundity.
R base version
The first line of the matrix reads 0 kitten produced between 0-3 months, 0 kitten between 3-6 months, and 9.1 / 2 / 4 = 1.4 kitten by capita by quarter for the 6-9 months class and the adults. The 1s on the diagonal are the survivals between age classes and the lower-right 1 the adult survival.
l <- matrix(c(0, 0, 1.4, 1.4,
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1),
nrow = 4,
byrow = TRUE)
quarters <- 16
n0 <- matrix(c(0, 0, 0, 2),
ncol = 1)
simul <- function(q) {
n_proj <- matrix(0,
nrow = nrow(l),
ncol = q)
n_proj[, 1] <- n0
for (i in 1:(q - 1)) {
n_proj[, i + 1] <- l %*% n_proj[, i]
}
return(n_proj)
}
res <- simul(quarters)
round(sum(res[, ncol(res)]))
# 2450
With our optimistic parameters, we get a population of 2,450 cats after 16 quarters (4 years). An order of magnitude less than in the article…
With a more realistic matrix, especially for feral cats, with less fertility for the first pregnancy and survival rates totally made-up but not 100 %, we can get quite a more manageable population size :
Renaud Kaeuffer, Dominique Pontier, Sébastien Devillard, Nicolas Perrin. Effective size of two feral domestic cat populations (Felis catus L.): effect of the mating system. Molecular Ecology, 2004, 13(2), pp. 483-490. https://doi.org/10.1046/j.1365-294x.2003.02046.x.hal-00427607
Hall, V.E. and Pierce, G.N., Jr. Litter size, birth weight and growth to weaning in the cat. Anat. Rec., 1934, 60: 111-124. https://doi.org/10.1002/ar.1090600113
Deag, J.M., Lawrence, C.E. and Manning, A. The consequences of differences in litter size for the nursing cat and her kittens. Journal of Zoology, 1987, 213: 153-179. https://doi.org/10.1111/j.1469-7998.1987.tb03687.x