-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02_standardise-plant-names.R
46 lines (41 loc) · 1.56 KB
/
02_standardise-plant-names.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
################################################################################
## Author: Abhishek Kumar
## Affiliation: Panjab University, Chandigarh
## Email: abhikumar.pu@gmail.com
################################################################################
## load R packages
library(rWCVP)
library(tidyverse)
## load raw recorded plant species for each site
mhp <- read.csv("data/morni_plants.csv") |>
select(powo_taxa, powo_author, powo_dist) |>
distinct() |>
mutate(Site = "Morni")
clp <- read.csv("data/chail_plants.csv") |>
select(powo_taxa, powo_author, powo_dist) |>
distinct() |>
mutate(Site = "Chail")
crp <- read.csv("data/churdhar_plants.csv") |>
select(powo_taxa, powo_author, powo_dist) |>
distinct() |>
mutate(Site = "Churdhar")
## exclude plant species with distribution outside study sites
site_plants <- bind_rows(mhp, clp, crp) |>
mutate(Presence = 1) |>
pivot_wider(names_from = "Site", values_from = "Presence", values_fill = 0) |>
filter(!is.na(powo_dist))
## match with WCVP (version 10)
taxa_match <- wcvp_match_names(
site_plants, name_col = "powo_taxa", author_col = "powo_author"
)
## save WCVP standardised plant names
taxa_match |>
left_join(
rWCVPdata::wcvp_names, by = c("wcvp_accepted_id" = "plant_name_id")
) |>
select(taxon_name, taxon_authors, genus, family,
powo_dist, lifeform_description, climate_description,
Morni, Chail, Churdhar) |>
distinct() |>
mutate(powo_dist = ifelse(powo_dist == "Doubtful", "Introduced", powo_dist)) |>
readr::write_excel_csv("output/site_plants_wcvp.csv")