Multi-key, single-key
In addition to locations, you will work with the teachers dataset in this exercise. It contains information about the teacher for each subject. The teacher of each subject does not change between semesters. Your goal is to build a new data.table containing the room allocation for each subject, using the teachers and locations data.tables.
Latihan ini adalah bagian dari kursus
Joining Data with data.table in R
Petunjuk latihan
- Identify the key column(s) for joining
teachersandlocationsand assign it as a character vector in the formc("teachers_join_key" = "locations_join_key")to thejoin_keyvariable. - Using the
data.tablesyntax, right joinlocationstoteachersusing thejoin_keyvariable.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Identify and set the keys
join_key <- ___
# Right join
___