KnitR/Workflow
Learn about the basic workflow in KnitR so you would be able to decide if additional learning modules make sense to you and the learning modules could help you to do standard repeating jobs with statistical software and document generation much easier in the future.
Workflow of KnitR
[edit | edit source]KnitR consists of standard e.g. MarkDown document with R-code chunks integrated in the document. The code chunks can be regarded as R-scripts that
- load data,
- preforms data processing and
- creates output data (e.g. descriptive analysis) or output graphics (e.g. boxplot diagram).
The implementation of logical conditions in R can provide text elements for the dynamic report depended on the statistical analysis.
Dynamic Text Generation with Calculated Acceptance of
[edit | edit source]Assumen that we have the following text is as text generation with acceptance of the H0 hypothesis with mentioning the calculated -value from a statistic software (in this case R)
The Wilcoxon Sign test was applied as statistical comparison of the average of two dependent samples data1 and data2. In this case the the calculated P-value was 0.056 and hence greater than the significance (0.05 by default). This implies that "H0: there is no difference between the results in data1 and data2" must be accepted.
Dynamic Text Generation with Calculated Rejection of
[edit | edit source]Depending on the R results (here 0.056) the text fragments are determined by logical conditions in the R-script. If the P-value was 0.045, which is lower than the significance (0.05 by default). An other appropriate text fragment is inserted in the dynamic report.
The Wilcoxon Sign test was applied as statistical comparison of the average of two dependent samples data1 and data2. In this case the the calculated P-value was 0.045 and hence smaller than the significance (0.05 by default). This implies that "H0: there is no difference between the results in data1 and data2" will be rejected.
By this workflow the replacement of the input data of the statistical or numerical analysis in R creates a reproducible report which the same methodology. The key in KnitR to accomplish this basic example of dynamic text generation is the application of text and numeric variables that are populate by R-Code, that are part of the source document.
Task for Learner
[edit | edit source]- Explain the benefits of an implementation in KnitR and an approach that generates text fragements depending on the calculated results!
- What are the main challenges for people that are used to write documents in the standard way e.g. with office document editors (e.g. like LibreOffice)!
- In this setting the interpretation of statistical results is human task of a scientist and not of KnitR. Select jobs in a scientific paper that you can provide to KnitR and define other to-dos that humans must perform!