Reputation: 642
In the documentation for dplyr all of the data manipulation verbs have a parameter called ".data". However, most parameters in R that involve data are simply called "data". Does anyone know why dplyr uses ".data" instead of just "data"?
I've been through several sources of information and I've had no luck finding an explanation. However, I need to be able to explain to students why this is the case. So, any insight would be greatly appreciated.
Here's a link to the documentation for your reference: https://cran.r-project.org/web/packages/dplyr/dplyr.pdf
Upvotes: 3
Views: 3530
Reputation: 642
Based on the comments provided by joran, 42, and hadley (who wrote dplyr), it appears that the correct answer is to avoid name collisions with the data()
function in the base packages in R.
It is considered a best practice to avoid name collisions, and thus the dot prefix is just an arbitrary character to disambiguate the .data
parameter in dplyr from the data()
function in the base R package.
Upvotes: 3