matching_df() implements matching between two groups of individuals with preferences specified by either a pair of data frames or a pair of data files (csv, tsv, or table).

matching_df(
  df1,
  df2,
  df_type = NULL,
  header = NULL,
  sep = NULL,
  algorithm = "DA",
  switch = FALSE,
  verbose = TRUE,
  mt1 = FALSE
)

Arguments

df1

A data frame or a data file containing preferences of the proposers.

df2

A data frame or a data file containing preferences of the proposed.

df_type

Type of df1 and df2, which should be one of "data.frame", "csv", "tsv", or "table". If not specified, matching_df() tries to determine the type.

header

A logical value showing if the data file has the header (variable names) row. If not specified, default is TRUE for "csv" and "tsv", and FALSE for "table".

sep

The field separator character. Values on each line of the file are separated by this character. If not specified, default is "," for "csv", "\t" for "tsv", and "" (white space) for "table".

algorithm

A algorithm for matching. "DA" ("Gale-Shapley", "GS") or "Boston".

switch

A logical value. If TRUE, the roles of g1 and g2 are switched. That is, g2 will be the proposer group, and g1 the proposed if TRUE. Default is FALSE.

verbose

If TRUE, matching steps will be printed on screen. Default to TRUE.

mt1

A logical valu. TRUE for many-to-one matching. Default to FALSE

Value

A list of "matching" class containing (1) a data frame of the matching results, (2) a character string showing which algorithm was used, (3) a character string of the matching results, (4) a character string of the history of matching steps, and (5) a list of preferences of each group.

Author

Yoshio Kamijo and Yuki Yanai yanai.yuki@kochi-tech.ac.jp

Examples


if (FALSE) {
  test7 <- matching_df(
    df1 = "foo1.csv",
    df2 = "foo2.csv")
}