mvl_merge: Merge two MVL data frames and write the result

View source: R/RMVL.R

mvl_mergeR Documentation

Merge two MVL data frames and write the result

Description

Merge two MVL data frames and write the result

Usage

mvl_merge(
  MVLHANDLE,
  df1,
  df2,
  name = NULL,
  by = NULL,
  by.x = by,
  by.y = by,
  suffixes = c(".x", ".y"),
  only.columns.x = NULL,
  only.columns.y = NULL
)

Arguments

MVLHANDLE

a handle to MVL file produced by mvl_open()

df1

a data.frame stored in MVL file

df2

a data.frame stored in MVL file

name

if specified add a named entry to MVL file directory

by

list of columns to use as key

by.x

list of columns to use as key for df1

by.y

list of columns to use as key for df1

suffixes

rename columns with identical names using these suffixes

only.columns.x

only copy these columns from df1

only.columns.y

only copy these columns from df2

Value

an object of class MVL_OFFSET that describes an offset into this MVL file. MVL offsets are vectors and can be concatenated. They can be written to MVL file directly, or as part of another object such as list.

See Also

mvl_hash_vectors, mvl_find_matches, mvl_group, mvl_find_matches, mvl_indexed_copy, mvl_order_vectors, mvl_fused_write_objects

Examples

## Not run: 
Mtmp<-mvl_open("tmp_a.mvl", append=TRUE, create=TRUE)
mvl_write_object(Mtmp, data.frame(x=rep(c("a", "b"), 50), y=1:100), "df1")
mvl_write_object(Mtmp, data.frame(x=rep(c("b", "c"), 50), y=runif(100), z=21:120), "df2")
Mtmp<-mvl_remap(Mtmp)
mvl_merge(Mtmp, Mtmp$df1, Mtmp$df2, by.x="y", by.y="z", only.columns.y=c("x"), name="df_merged")
Mtmp<-mvl_remap(Mtmp)
print(Mtmp$df_merged[1:10,])

## End(Not run)

RMVL documentation built on Nov. 2, 2023, 6:09 p.m.

Related to mvl_merge in RMVL...