A battle plan
1. A battle plan
In this final chapter, we'll think about the structure of R projects.2. Starting small
The key idea we'll consider, is breaking our work into small and managable chunks. This will make it easier for us to spot bugs and to build on past work.3. What's in a (file)name?
Regardless of the complexity of our analysis, our R code is stored in simple text files. So this means that having sensible filenames can help our organization and reduce the amount of time we spend searching for things. Consistency in filenames is, would you believe, key. But, what sort of rules could we follow?4. Multiple words
Filenames often contain multiple words. For example, cluster analysis, load survival data and plot residuals.5. Spaces, dashes or underscores?
Simple question. How should you separate words in a filename? You could use a space, an underscore or a dash? Is there a difference? Does it matter? Take a second to answer these two questions: Which do you use to separate words in a filename? Now, what do you think you should use?6. Spaces in filenames
Spaces in filenames: Just don't. Really, I mean don't use them. They are always a bad idea. For example, if you put the file on the web, the space is not longer a space. If you use regular expression, it's now a bit harder. Also, can you spot the difference between one space and two spaces?7. Dashes or underscores
Underscores also have a few minor problems. Google prefers dashes for separating words and the regular expression character slash w lumps underscores in with standard characters. Dashes don't have the above problems. Confession time. I tend to use underscores. It's just a hard habit to break, but I'm trying.8. Let's have some practice
Practice time!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.