[R] Dumping functions to RCS
F.Tusell
etptupaf at bs.ehu.es
Fri Apr 28 16:17:19 CEST 2000
> Sender: bates at franz.stat.wisc.edu
> Cc: r-help at stat.math.ethz.ch
> From: Douglas Bates <bates at stat.wisc.edu>
> Date: 28 Apr 2000 09:08:36 -0500
>
> "F.Tusell" <etptupaf at bs.ehu.es> writes:
>
> > To keep track of an ongoing programming project, I would like to dump
> > all my functions to individual ASCII files named xxx.R, yyy.R, etc.
> > Presently I do so manually in order to use RCS (on a Linux machine),
> > so I can keep track of all versions, differences, snapshots, etc.
> >
> > Is there any easy way to dump all functions in the workspace to
> > individually named files? Thank you very much for any ideas.
>
> You can use dump() in a loop over the result of objects(). I added
> one enhancement below to select only the functions.
>
> > sqr <- function(X) X^2
> > cube <- function(X) X^3
> > x <- 1:3
> > for (obj in objects()) { # produces files sqr.R and cube.R
> + if (is.function(get(obj))) {
> + dump(obj, fileout = paste(obj, ".R", sep = ''))
> + }
> + }
>
> I think the preferred solution is to create your own R package and to
> use RCS (or CVS) to maintain the source directories for the package.
>
> Creating packages for R is actually rather easy now that scripts like
>
> R CMD build <pkgname>
>
> are available. The process is described in the manual "Writing R
> Extensions".
>
> --
> Douglas Bates bates at stat.wisc.edu
> Statistics Department 608/262-2598
> University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/
>
Thank you very much. Thats exactly what I wanted.
Yes, the creation of an R package seems the way to
go. I'll check "Writing R Extensions".
ft.
--
Fernando TUSELL e-mail:
Departamento de Econometría y Estadística etptupaf at bs.ehu.es
Facultad de CC.EE. y Empresariales Tel: (+34)94.601.3733
Avenida Lendakari Aguirre, 83 Fax: (+34)94.601.3754
E-48015 BILBAO (Spain) Secr: (+34)94.601.3740
PGP: finger etptupaf at bsdx01.bs.ehu.es http://agesi.bs.ehu.es
----------------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list