left_join inaccurate results

I have two tables that I'm trying to do a left join. Both have a qrt column that's shared.

Q1 2019 from the qrt table is connecting to other rows in the hotspots_allcalls_summarytbl except for 415 Fairmont Dr.

Technically I should see an NA in the resulting joined table with 415 Fairmont Dr since there isn't an associated Q1 2019 415 Fairmont Dr value in the second (right) table, but it's not showing up in the resulting table. Any ideas why this might be?

The line of code is:
hotspots_allcalls_summarytbl2 <- left_join(qrt, hotspots_allcalls_summarytbl)

the left join is satisfied by having shown you at least one Q1 2019 in results. it seems you have 7. if you had none rather than 7 I would expect to see a single NA result for it on the right. otherwise it should have as many records as do in fact match, (7)

Why wouldn't a left join return back NA for 415 Fairmont Dr?

Shouldn't a left join keep all the values from the left table and then if there's no match with the right table, then wouldn't there be a resulting row with NA?

So there should be an 8th row with: Q1 2019, 2019, 415 Fairmont Dr, NA?

What entry on the left table was unmatched yet absent in the result? There are matches for the date of interest, 7 of them, and they were returned.

The one I had mentioned at the end of my last response. There should be a row that has:

Q1 2019, 2019, 415 Fairmont Dr, NA

I think what I'm looking for might be a full join. Thoughts?

It would be helpful if you could share before and after tables that illustrate what you're looking for. The tribble() function is good for making small tables where you enter data in a way the mimics the visual structure; the tibble() function works, too, but has horizontal and vertical structure switched.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.