combine_data {radiant.data}R Documentation

Combine datasets using dplyr's bind and join functions

Description

Combine datasets using dplyr's bind and join functions

Usage

combine_data(
  x,
  y,
  by = "",
  add = "",
  type = "inner_join",
  data_filter = "",
  arr = "",
  rows = NULL,
  envir = parent.frame(),
  ...
)

Arguments

x

Dataset

y

Dataset to combine with x

by

Variables used to combine 'x' and 'y'

add

Variables to add from 'y'

type

The main bind and join types from the dplyr package are provided. inner_join returns all rows from x with matching values in y, and all columns from x and y. If there are multiple matches between x and y, all match combinations are returned. left_join returns all rows from x, and all columns from x and y. If there are multiple matches between x and y, all match combinations are returned. right_join is equivalent to a left join for datasets y and x. full_join combines two datasets, keeping rows and columns that appear in either. semi_join returns all rows from x with matching values in y, keeping just columns from x. A semi join differs from an inner join because an inner join will return one row of x for each matching row of y, whereas a semi join will never duplicate rows of x. anti_join returns all rows from x without matching values in y, keeping only columns from x. bind_rows and bind_cols are also included, as are intersect, union, and setdiff. See https://radiant-rstats.github.io/docs/data/combine.html for further details

data_filter

Expression used to filter the dataset. This should be a string (e.g., "price > 10000")

arr

Expression to arrange (sort) the data on (e.g., "color, desc(price)")

rows

Rows to select from the specified dataset

envir

Environment to extract data from

...

further arguments passed to or from other methods

Details

See https://radiant-rstats.github.io/docs/data/combine.html for an example in Radiant

Value

Combined dataset

Examples

avengers %>% combine_data(superheroes, type = "bind_cols")
combine_data(avengers, superheroes, type = "bind_cols")
avengers %>% combine_data(superheroes, type = "bind_rows")
avengers %>% combine_data(superheroes, add = "publisher", type = "bind_rows")


[Package radiant.data version 1.6.6 Index]