swcarpentry / r-novice-inflammation

Programming with R
http://swcarpentry.github.io/r-novice-inflammation/
Other
163 stars 395 forks source link

`c` function means concatenate, not combine #495

Closed reblake closed 1 year ago

reblake commented 3 years ago

I'm currently teaching this SWC R lesson, and I noticed an incorrect definition of the c function in the 01-starting-with-data section. It says the c function means "combine", but it actually means "concatenate". Correcting this definition will improve clarity for learners.

Jariati commented 3 years ago

I learnt from some R resources. I think 'c' function can be both, concatenate or combine. There is an explanation: if factor concatenation by c() should give a factor. It means, when user use c() function, they combine some details. In other words, I don't think by replacing combine with concatenate will provide significant changes in clarity.

HaoZeke commented 3 years ago

We would like to stick to the standard definition from ?c: image Thanks for bringing this up though!

reblake commented 3 years ago

@HaoZeke, the definition of the function is not the name of the function. The name of the function is "concatenate" ("c" for short), while the definition of the function is what it does ("combine values...").
See the comments here: https://stackoverflow.com/questions/11488820/why-use-c-to-define-vector Also, see the R manual section 2.1: https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf

Many functions can combine objects in R, so being specific that this functions is concatenate (vs. paste, cat, etc.) is important for learners, especially those new to R.

HaoZeke commented 3 years ago

@reblake my apologies. For posterity I'm also putting the relevant section of the manual (linked)

image

However, it seems to still be a little contested, not an authoritative reference at all but R For Dummies feels happy to call it combine.

image

Further muddying the waters, I normally teach paste for concatenate, simply because of the R definition.

image

I'll leave this open for a bit, but I'm not sure we should call it anything at all at this point. A PR to remove mention of what it stands for would be best.

zkamvar commented 1 year ago

fixed in #537