![]() ![]() In fact, I had used this example a few times by myself in my presentations before I discovered this problem during one of my talks, but I discovered it anyway.Īlthough the above is a toy example, it could become a horror story if it happens in scientific research that was not done in a reproducible way (e.g., cut-and-paste). Had you copied a number -17.579 computed elsewhere into this document, it would be very difficult to realize the problem. All you have to do is change b to b, and click the Knit button again. Did you notice a problem? The object b is the vector of coefficients of length 2 from the linear regression b is actually the intercept, and b is the slope! This minimal example shows you why R Markdown is great for reproducible research: it includes the source code right inside the document, which makes it easy to discover and fix problems, as well as update the output document. Now please take a closer look at the example. Figure 2.2 shows the output in the RStudio Viewer.įIGURE 2.2: The output document of the minimal R Markdown example in RStudio. You can click the Knit button to compile the document (to an HTML page). Below is a code chunk: ```).Īn inline R code expression starts with `r and ends with a backtick `.įigure 2.1 shows the above example in the RStudio IDE. This is a paragraph in an R Markdown document. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |