In R, what exactly is the problem with having variables with the same name as base R functions?

后端 未结 7 1390
深忆病人
深忆病人 2020-11-30 03:48

It seems to be generally considered poor programming practise to use variable names that have functions in base R with the same name.

For example, it is tempting to

相关标签:
7条回答
  • 2020-11-30 04:29

    While some languages might allow it, IF IF THEN THEN ELSE ELSE come to mind. In general it is considered very poor practice. Its not that we don't want to give you the opportunity to show off your advanced knowledge of the language, its that one day, we will have to deal with that code and we are but mortals.

    So save your programming tricks from breaking the nightly builds and give your variables reasonable names, with consistent casing if you are feeling extra warm and fuzzy.

    0 讨论(0)
提交回复
热议问题