On Tue, May 28, 2013 at 7:54 AM, Mark Breman <breman.m...@gmail.com> wrote: > Hello List, > > When i paste a large block of R code from an editor to the R command line > the execution of the code will often fail at some point because it is not > pasted as it was copied.
This reminds me of the Tommy Cooper joke (I can't do the voice, especially over email): Man: "Doctor, it hurts when I do this" [waves arm about] Doc: "Well don't do that then". Cutting and pasting code - especially large blocks of code - is a poor way to work with R. Make your code re-usable by putting it in functions with sensible arguments and meaningful return values. Debug your functions with little test data sets, or go the whole hog and use package:testthat for writing test suites. Organise your functions into packages and use package:devtools to make packages REALLY REALLY easy. Easier than having a big text file with all the R code you've ever written in, and then pasting chunks of into R every time. Or pasting it back into your big text file and then changing a little bit of it so you now have two very similar chunks of R code with the same bug now in two positions.... Take a day to read up on how to effectively work with R with functions and packages, then revisit your work and see how that can apply to you. You'll get that day back within a couple of weeks. B ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.