r-novice-inflammation icon indicating copy to clipboard operation
r-novice-inflammation copied to clipboard

`c` function means concatenate, not combine

Open reblake opened this issue 3 years ago • 4 comments

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.

reblake avatar Dec 14 '20 20:12 reblake

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.

Jariati avatar Dec 23 '20 22:12 Jariati

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

HaoZeke avatar Dec 29 '20 01:12 HaoZeke

@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.

reblake avatar Jan 04 '21 13:01 reblake

@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.

HaoZeke avatar Jan 04 '21 21:01 HaoZeke

fixed in #537

zkamvar avatar Apr 26 '23 22:04 zkamvar