Function that returns an index indicating the row in one data frame that matches the row in another data frame.

match_rows(dtf_to, dtf_from)

Arguments

dtf_to

A data frame with the rows to match over.

dtf_from

A data frame with the rows to compared against.

Value

A list equal in length to the number of rows in dtf_to with the row indices from dtf_from that matches a given row in dtf_to. If no matches are found returns NA.

Examples

dtf_example_1 <- data.frame( c( LETTERS[3:1], 'Z' ), V2 = c( 3:1, 26 ) )
dtf_example_2 <- data.frame( LETTERS[1:6], V2 = 1:6 )
match_rows( dtf_example_1, dtf_example_2 )
#> [[1]]
#> [1] 3
#> 
#> [[2]]
#> [1] 2
#> 
#> [[3]]
#> [1] 1
#> 
#> [[4]]
#> [1] NA
#>