Dear All -
The problem: comment lines in an R function (lines beginning with # ) are 
*sometimes* removed on leaving the R default editor (same with notepad).
I'm working on a Windows machine with R version 2.14.1.
An example is below. Couldn't find anything that seemed to relate to this in 
the Changelog. I don't recall encountering this behavior with previous versions 
of R. Any suggestions on how to preserve the comment lines would be greatly 
appreciated. Many apologies if this is a stupid question. Cleridy


## this function has comments at the top:

> mapsp.sqrtcpd.f

function (input.frm, cpd.numerator, cpd.denominator, basis.dim,

      npts, nyrs.unq, prop.ctch)

{

# here are some comments

# and more

#

      year.min<- 1975

......



## copy function to a dummy function:

> tmp.f<-mapsp.sqrtcpd.f



## now edit it with fix and remove a ) so that it complains:

>  fix(tmp.f)

Error in edit(name, file, title, editor) :

    unexpected symbol occurred on line 15 use a command like

x<- edit()

to recover



## and now recover it and add back in the ) that had been removed :

> tmp.f<-edit()



## and look to see what happened... no comments at the top anymore..

> tmp.f

function (input.frm, cpd.numerator, cpd.denominator, basis.dim,

      npts, nyrs.unq, prop.ctch)

{

      year.min<- 1975

......


        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to