Closed delocalizer closed 7 years ago
@delocalizer thanks for the comment. Which episode and line number is the current explanation on?
Hi @naupaka, it is episode 3, in challenge 2: https://github.com/swcarpentry/r-novice-gapminder/blame/gh-pages/_episodes/03-seeking-help.md#L177
@delocalizer I agree the current explanation is not so helpful. I also agree your example is clearer, but I think you're right about the problem about relying on a solid understanding of vectorized operations.
What about:
> paste(c("a","b"), "c")
[1] "a c" "b c"
> paste(c("a","b"), "c", sep = ",")
[1] "a,c" "b,c"
> paste(c("a","b"), "c", sep = ",", collapse = "|")
[1] "a,c|b,c"
Yes, that looks good to me
@delocalizer want to submit a PR with this change?
sure thing
From: Naupaka Zimmerman notifications@github.com Sent: Thursday, 27 April 2017 12:12 AM To: swcarpentry/r-novice-gapminder Cc: Conrad; Mention Subject: Re: [swcarpentry/r-novice-gapminder] "Seeking Help" challenge 2 answer & example misleading (#256)
@delocalizerhttps://github.com/delocalizer want to submit a PR with this change?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/swcarpentry/r-novice-gapminder/issues/256#issuecomment-297421093, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAx6kc4uqBqEcnRR2pw_4o0_3CZ7cI_rks5rz1C2gaJpZM4MvQdR.
Closed by #262
The explanation of the difference between
sep
andcollapse
is if not wrong, then pretty misleading - the actual difference between these is thatsep
string separates terms, andcollapse
joins results after concatenation. The example given only works because the arguments supplied are of length 1, which is a sort of degenerate case forpaste
. A clearer example would be:but this presumes a knowledge of vectors that the lesson hasn't yet reached at this point. So perhaps choose a different function than
paste
to use as an example?