Levé a pravé spojení

Joining Data with data.table in R

Scott Ritchie

Postdoctoral Researcher in Systems Genomics

Levá spojení

Přidání informací z pravé data.table do levé data.table

merge(x = demographics, y = shipping, by = "name", all.x = TRUE)

Joining Data with data.table in R

Pravá spojení

Přidání informací z levé data.table do pravé data.table

merge(x = demographics, y = shipping, by = "name", all.y = TRUE)

Joining Data with data.table in R

Pravá spojení – levá spojení

# Right join
merge(x = demographics, y = shipping, by = "name", all.y = TRUE)

# Same as
merge(x = shipping, y = demographics, by = "name", all.x = TRUE)
Joining Data with data.table in R

Výchozí hodnoty

  • Výchozí hodnoty parametrů all, all.x a all.y jsou FALSE ve funkci merge()

  • Výchozí hodnoty argumentů funkce lze zjistit pomocí help("merge")

Joining Data with data.table in R

Pokyny ke cvičení

Levé spojení shipping s demographics:

merge(demographics, shipping, by = "name", all.x = TRUE)

Pravé spojení shipping s demographics:

merge(demographics, shipping, by = "name", all.y = TRUE)
Joining Data with data.table in R

Pojďme procvičovat!

Joining Data with data.table in R

Preparing Video For Download...