Open Aariq opened 1 year ago
@Aariq Thanks for the suggestion! For tutorials, it often makes sense to do tasks separately even if it's possible to combine them, so the process and the steps are clearer to the student. I'll leave it up to @kjones13 whether to make this change.
Yeah, I totally get that. I just felt to me like it would make more sense to explain that you want to join by certain columns rather than that you want to avoid certain columns when joining.
Hi @Aariq, this is very clean code, and I really I appreciate the suggestion. In this instance, the intent in this step was to be explicit about acknowledging the fieldnames the two data frames have in common and intentionally renaming the fields before joining, as part of the data exploration step.
https://github.com/NEONScience/NEON-Data-Skills/blob/e59c9c2ba55dbcc67ae3f37d80bbbf39c9e914e5/tutorials/R/biodiversity/neon-phenology-temp/01-explore-phenology-data/01-explore-phenology-data.R#L113-L121
Instead of renaming columns manually before
left_join()
ing, you can do something like this:This will add the suffix "Stat" to any duplicate column names not in the vector supplied to
by