Try next code:
library(dplyr)
library(tidyr)
#Code
data <- df %>% pivot_longer(everything()) %>%
left_join(keys,by = c('name'='sample_name'))
#Split
List <- split(data,data$site_name)
List <- lapply(List,function(x) {x$site_name<-NULL;x})
list2env(List,envir = .GlobalEnv)
Outputs:
List
$chic_1
# A tibble: 2 x 2
name value
<chr> <dbl>
1 chic56.345 0.6
2 chic56.345 1.2
$tex_1
# A tibble: 2 x 2
name value
<chr> <dbl>
1 tex21.222 0.5
2 tex21.222 0.8
$wa_1
# A tibble: 2 x 2
name value
<chr> <dbl>
1 wa34.907 1.12
2 wa34.907 0.9
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…