Watts-College / cpp-529-spr-2022

https://watts-college.github.io/cpp-529-spr-2022/
0 stars 2 forks source link

Solving problem with duplicate variables #33

Closed dholford closed 2 years ago

dholford commented 2 years ago

I'm having an issue with the step where I merge the dorling cartogram with the data we manipulated:

por <- merge( POR_dorling, d, by.x="GEOID", by.y="tractid", all.x=T )

Since some variables were used in both the POR_dorling data frame and the d data frame, duplicate values are given .x and .y. But then in my dashboard it can't find any of the variables that happen to be duplicates since the variable name now has .x or .y attached to it.

I can't quite wrap my head around how to avoid the duplicate names in both data sets or how to avoid getting .x and .y affixed to the duplicate variables. The only solution I can think of is adding .x or .y to the variables in my code for the dashboard, but since not all variables have duplicates, I'd have to look up each one individually.

output
dholford commented 2 years ago

I'm afraid that if I drop by.x and by.y I may end up missing something important.