[R] How to source a part of the file

From: Paul Y. Peng <pywpeng_at_gmail.com>
Date: Fri, 11 Mar 2011 16:41:20 -0500


I have a text file of R commands. Some times I only want to run a few lines of the R commands in an existing R session and wonder whether there is a simple way to do this.

To run a few lines in a new session of R, I could use sed to pick up the lines from the file and pipe them into R.

source() does not allow me to specify which lines to be included/excluded. Is there any function that is similar to source() but allows me to specify lines included/excluded?

Paul.

        [[alternative HTML version deleted]]



R-help_at_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. Received on Fri 11 Mar 2011 - 21:47:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Mar 2011 - 22:00:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive