Learn R Programming

analyzer (version 1.0.1)

mergeAnalyzer: Analyze data for merging

Description

mergeAnalyzer analyzes the data drop after merge

Usage

mergeAnalyzer(x, y, round.digit = 2, ...)

Arguments

x

left data to merge

y

right data to merge

round.digit

integer indicating the number of decimal places to be used

...

other parameters needs to be passed to merge function

Value

Returns merged data with same class as that of input data. Prints summary of data retained after merging. The summary has 6 columns:

  • Column: Number of rows and union of column names of numeric columns in both the data

  • x, y: Sum of columns in both table

  • Merged: Sum of columns in merged data

  • remainingWRTx: ratio of remaining data in merged data after merging. example - 0.5 means that 50 of inner join). 1.5 means value became 150 duplicates present in data

  • remainingWRTy: same as above, but for y table

Details

Prints the summary of data retained after merge and returns the merged data. This function uses data.table (if the package is installed) for faster data merge

Examples

Run this code
# NOT RUN {
# Creating two tables to merge
A <- data.frame(id = c("A", "A", "B", "D", "B"),
                valA = c(30, 83, 45, 2, 58))

B <- data.frame(id = c("A", "C", "A", "B", "C", "C"),
                valB = c(10, 20, 30, 40, 50, 60))

mergeAnalyzer(A, B, allow.cartesian = TRUE, all = FALSE)

# }

Run the code above in your browser using DataLab