I am working with the following dataset
library(data.table)
dat <- fread("https://www.dropbox.com/s/kj66h9shv6zge91/mydat.csv?dl=1")
which looks like this:
source_id experiment_id variable_id
1: CESM2-WACCM-FV2 historical pr
2: CESM2-WACCM-FV2 historical pr
3: CESM2-WACCM-FV2 historical tas
4: CESM2-WACCM-FV2 historical tas
5: FGOALS-f3-L historical pr
---
5657: MRI-ESM2-0 ssp585 pr
5658: CESM2-WACCM ssp585 pr
5659: CESM2-WACCM ssp585 tas
5660: CESM2-WACCM ssp585 tas
5661: CESM2-WACCM ssp585 tasmax
For each variable_id
, I am trying to find a list of the elements in source_id
that are simultaneously present in all elements of experiment_id
(e.g. "historical", "ssp126", "ssp245", "ssp370", "ssp585").
Any ideas on how to get there? Looks like a simple question, but I could not find an adequate answer on SO that works with characters rather than numeric values.