Skip to content

i need help in documentation

5 messages · R. Michael Weylandt, Bert Gunter, purushothaman +1 more

#
Hi,

i am new in R development ,

so i need help in documentation from comments in R file

for example

sample<-function(filepath)
{

	##title<< read csv file
	##author<< Purushoth
	##description this function is used to read a csv file
    output<-read.csv(filepath)
   return(output)
}

i need to get html document file using this comments


Thanks 
B.Purushothaman

--
View this message in context: http://r.789695.n4.nabble.com/i-need-help-in-documentation-tp4635471.html
Sent from the R help mailing list archive at Nabble.com.
#
R does not, to my knowledge, have anything quite like Python's
docstrings (which seems to be what you are talking about) but you
might look at Roxygen2 on CRAN which should get you started in this
direction.

Best,
Michael
On Thu, Jul 5, 2012 at 7:37 AM, purushothaman <purushothaman.b at ge.com> wrote:
#
Hi,

i tried with inlinedocs package function extract.docs.file. it have exactly
what i need but it return as list.

can u help me how to convert list to html documentation.


Thanks
B.Purushothaman

--
View this message in context: http://r.789695.n4.nabble.com/i-need-help-in-documentation-tp4635471p4635578.html
Sent from the R help mailing list archive at Nabble.com.
#
On 07/05/2012 10:37 PM, purushothaman wrote:
Hi B.Purushothaman,
Does this do what you want?

instream<-file("sample.R","r")
sample.txt<-readLines(instream)
close(instream)
library(prettyR)
delim.table(
  as.matrix(sample.txt[grep("##",sample.txt,fixed=TRUE)]),
  html=TRUE,label="Doc for sample.R")

<html><body>

Doc for sample.R</tr>
<table border=1>
</tr>
<tr><td>        ##title<< read csv file</tr>
<tr><td>        ##author<< Purushoth</tr>
<tr><td>        ##description this function is used to read a csv file</tr>
</table>

Jim