![]() I run code and then leave some commentary, including things I learned, mistakes, and what I want to try next. I turn this into a journal by explaing what I’m doing as I do it. With R Markdown, I can organize all this into one coherant file. These R scripts tend to be very long because I often create lots and lots of plots and when I go through the code I can never remember which one is the one I want and waste a lot of time executing code just to find the plot I want. I create lots of plots and run lots of statistical models trying to get a feel for what I can find in my data. When I’m starting a new project, I do a lot of exploratory analysis. ![]() ![]() Let me give you several examples of things I do in R Markdown. The benefit of this is that you can type all the prose you want and then put some relevant block of R code and all the output will be right there. Essentially, it’s a way to combine notes and an R script in one file. R Markdown is a good solution to this problem. But even then, there’s often a disconnect between what’s in my notes and what is in my R script. For many of my projects, I have an accompanying file where keep all my notes, kind of like a journal of what I did that day. You forget why do did what you did and what things you learned from it. You might add some structure to the script using headers, and you can add comments to explain what code does, but after a while it can get unwieldy because there’s no narrative in your script. But sometimes if you’re working on a particular project you might end up with one very long script. So far, most of what you’ve done in R has been with R scripts, which is perfectly fine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |