I recently answered a SO question and got criticized for not attributing a commenter. He had provided a snippet of code that's obviously the right approach but falls short of a full answer. In my fuller answer, I had come up with the same code independently but copy-and-pasted what he provided to save some typing. Am I really in the wrong here?
Here's the exchange: Problems fixing character vectors in R with gsub()
gsub("_|\\.\\.\\.|\\." , "" , Smallstore1 )
, your full, and unedited (second) attempt at an answer was...names(Smallstore1) <- gsub("_|\\.\\.\\.|\\." , "" , Smallstore1)
, along with some explanatory text at the bottom which replicates what I said in my original comment!names(Smallstore1) <- gsub("_|\\.\\.\\.|\\." , "", names(Smallstore1))
, because otherwise it's inaccurate. The explanatory text pointed out that the poster had usedgsub
incorrectly, something that any good answer should address, in my opinion.