[Rd] checking for _non-existing_ -> documentation and sources at one place.

Wolski wolski at molgen.mpg.de
Fri Sep 17 10:45:10 CEST 2004


Hi!

Is it working with S4? If I understand it right you have to keep each function in an separate file?

What I am looking for is something what would resembles more something like this:


setClass("test",                                   #The test data storage class.                               <-from this the title section is generated automatically. 
	representation(
	size="numeric"                     # list size                                     <-section slots is generated automatically.
	bla="list"                              # stores content                            <-goes to section slots
	##description : Stores test results....                                                               <- goes to the description section.
	##example: x <- new("test",size=1000,bla=vector("list",1000))                            <-goes to the example section of the Rd file.
	))

setMethod("unlist" # unlists a list.
	,signature(x="test"  #+                  <-the #+ sign indicates that the docu of this function should be integrated in the docu file of the class "test" above. If non in a speparate file.
	
	)
	def=function(x,...)
	{
		.....	
	}
	#example: unlist(x)                       <- because as indicated by the "+" above it is appendended to the example section of the test-Class.Rd file.
	)

setMethod("unlist" # unlists a list.
	,signature(x="test"                 # an object of class test        <- no plus means it goes to a own unlist-methods.Rd file and the comment goes to the argument section.
               )                     
	def=function(x,...)
	{
	##Description : function does this and that.
	## further description...
		....
	}

	##example : data(x)
	## unlist(x)                      
	)


And then to have a tool eg something working like R CMD makeRd (perl script)... which genreates Rd files out of it..
Has nobody a perl-script that parseres the R files to generate Rd files? Would someone be interested in something similar. If so let me know please.


/E



*********** REPLY SEPARATOR  ***********

On 9/17/2004 at 9:07 AM Mark.Bravington at csiro.au wrote:

>>>Wolski wrote:
>>> 
>>>#I knew about prompt and promptMethods promptClass. They are 
>>>#extremely useful if you are starting to write a package. But 
>>>#what with existing packages that have to be rewritten?
>>>#
>>>#Having code and documentation in one place would be a great 
>>>#help. Has anyone a tool which is able to generate from 
>>>#appropriately commented R-code files (e.g. <<example>>= 
>>>#-example section) Rd files:
>>>#e.g. a noweb lit-prog file or patched version of Doxygen?
>>>#
>>>
>>>Yes, there is such a tool-- or something close to it, anyway. My
>>>'mvbutils' package lets you keep documentation in the same source "file"
>>>as the the function definition, appended at the end. Usually, when I am
>>>developing a function I start by writing informal documentation (which
>>>still displays with "?" but isn't an Rd file). Eventually I convert the
>>>documentation into a plain-text format close to the pager representation
>>>of R help files; this format can be converted into a .Rd file using my
>>>'doc2Rd' function. Once I am close to having a whole package ready, I
>>>use the 'formalize.package' function to set up the a whole package; it
>>>creates the skeleton and the .R source file, and all the .Rd files via
>>>'doc2Rd', ready for RCMD.
>>>
>>>For more details, have a look at README.mvbutils()
>>>
>>>Hope this helps
>>>
>>>Mark
>>>
>>>*******************************
>>>
>>>Mark Bravington
>>>CSIRO (CMIS)
>>>PO Box 1538
>>>Castray Esplanade
>>>Hobart
>>>TAS 7001
>>>
>>>phone (61) 3 6232 5118
>>>fax (61) 3 6232 5012
>>>Mark.Bravington at csiro.au



Dipl. bio-chem. Witold Eryk Wolski             @         MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin                'v'    
tel: 0049-30-83875219                        /   \       
mail: witek96 at users.sourceforge.net        ---W-W----    http://www.molgen.mpg.de/~wolski 
      wolski at molgen.mpg.de



More information about the R-devel mailing list