So I am making an .rmd file to document the development of some functions I am building. I am working in R studio. I noticed when I typed
```{r echo=TRUE, tidy=FALSE }
createExamData
```
it resulted in this in the knitted document
## function (directory)
## {
## files = list.files(directory)
## files = files[grepl("i", files)]
## files = substring(files[], 1, 4)
## examData <- LoadData(directory)
## nExams <- length(examData[[1]])
## adjMatrixStd <- list(length = nExams)
## for (i in 1:nExams) {
## iExam <- examData[[1]][[i]]
## iExam <- iExam[order(iExam[, 1]), ]
## gExam <- examData[[2]][[i]]
## gExam <- gExam[order(gExam[, 1]), ]
## key <- examData[[3]][[i]]
## adjMatrixStd <- ComputeStdAdjMatrix(gExam)
## adjMatrixWt <- ComputeWeightedMatrix(iExam, gExam, key)
## adjMatrixConv <- calculateConvinceMtd(iExam, gExam)
## save(iExam, gExam, key, adjMatrixStd, adjMatrixWt, adjMatrixConv,
## file = paste(files[i], ".Rdata", sep = ""))
## }
## }
I had already done a good job commenting my code and really didn't want to have to rewrite my comments in the markdown document for every function I need to display. My question is how do I get knitr to display my comments inside my functions if I am making a Rmarkdown file in R studio?
I should mention when I used the option to run just the individual 'chunk' in R studio it printed the function with the comments included so I think it must have something to do with the was the IDE defaults handle knitr.