Identifying observations shared by multiple tables
The list of data tables, gdp
, is available in your workspace. Your goal is to find the countries that are located in more than one continent, i.e., rows that are present in more than one data.table
in gdp
.
Cet exercice fait partie du cours
Joining Data with data.table in R
Instructions
- Use the
fintersect()
(docs) function to build a newdata.table
containing countries located in both Europe and Asia. - Concatenate all
data.table
s ingdp
and assign it togdp_all
. - Use the
duplicated()
function to filtergdp_all
to rows that are duplicates to find all countries located in more than one continent.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Obtain countries in both Asia and Europe
___
# Concatenate all data tables
gdp_all <- ___
# Find all countries that span multiple continents
___