Is there a way I can combine multiple lines of R commands (see below) into a little code snippet or a program in a text file, and run it in R to do my analysis? sink("mysink.txt") for (......) { code for creating a dataframe from supplied data code for doing anova from selected data } Thanks very much. Karth.
source("mycode.R") On Thursday 23 October 2003 15:29, Subramanian Karthikeyan wrote:> Is there a way I can combine multiple lines of R commands (see below) into > a little code snippet or a program in a text file, and run it in R to do my > analysis? > > sink("mysink.txt") > for (......) { > code for creating a dataframe from supplied data > code for doing anova from selected data > } > > Thanks very much. > > Karth. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help-- Arne Henningsen Department of Agricultural Economics Christian-Albrechts-University Kiel 24098 Kiel, Germany Tel: +49-431-880-4445 Fax: +49-431-880-1397 ahenningsen at email.uni-kiel.de http://www.uni-kiel.de/agrarpol/ahenningsen/
Subramanian Karthikeyan wrote:> Is there a way I can combine multiple lines of R commands (see below) into > a little code snippet or a program in a text file, and run it in R to do my > analysis? > > sink("mysink.txt") > for (......) { > code for creating a dataframe from supplied data > code for doing anova from selected data > } > > Thanks very much. > > Karth. >I guess you are looking for ?source. Uwe Ligges
On Thu, Oct 23, 2003 at 09:29:46AM -0400, Subramanian Karthikeyan wrote:> Is there a way I can combine multiple lines of R commands (see below) into > a little code snippet or a program in a text file, and run it in R to do my > analysis?It's quite easy: Write your R code with your favorite text editor and run it in R using source(). cu Philipp -- Dr. Philipp Pagel Tel. +49-89-3187-3675 Institute for Bioinformatics / MIPS Fax. +49-89-3187-3585 GSF - National Research Center for Environment and Health Ingolstaedter Landstrasse 1 85764 Neuherberg, Germany