Message-ID: <4FF6CE12.1040006@bitwrit.com.au>
Date: 2012-07-06T11:37:54Z
From: Jim Lemon
Subject: i need help in documentation
In-Reply-To: <1341491872432-4635471.post@n4.nabble.com>
On 07/05/2012 10:37 PM, purushothaman wrote:
> 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
>
>
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