Can someone please explain the following output?
> "naics_new_code__c"%in%names(df)
[1] TRUE
> names(states)
[1] "application_state__c" "naics_new_code__c" "loan_id" "wa_credit_score__c"
> df= merge(df,states,by = "loan_id")
> "naics_new_code__c"%in%names(df)
[1] FALSE
> df= merge(df,states,by = "loan_id")
> "naics_new_code__c"%in%names(df)
[1] TRUE
So, as you can see, on the first merge, the field "naics_new_code__c" does not become attached to my df. However, on the second merge, which is completely redundant, it does. Why would this be happening?
NOTE: this is a theoretical question about r. Adding a reproducible example would not only be superfluous in this case, but would make the answer less general and efficient for someone else with a similar problem to look up and answer for themselves.
Best,
Paul