[R] i need help in documentation

Jim Lemon jim at bitwrit.com.au
Fri Jul 6 13:37:54 CEST 2012


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



More information about the R-help mailing list