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 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-help at 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.
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
Apparently Analagous Threads
- how to create table with file link in Rd File
- How to get all list item to one string variable
- R CMD build with mingw and msys (PR#9766)
- Help request: Parsing docx files for key words and appending to a spreadsheet
- Help request: Parsing docx files for key words and appending to a spreadsheet