ABSTRACT

This chapter focuses on some of the most common coding mistakes to make, and some R quirks: capitalisation mistakes; forgetting brackets, quotation marks, and commas; forgetting ‘+’ in a ggplot; forgetting to call a ggplot object; piping but not making an object; changing a factor to a number; and variables automatically being read as factors. R is case sensitive. Small mistakes in capitalisation will mean that R will not be able to find practitioners objects. This situation can be avoided by always using lowercase lettering for objects, and making sure object names are distinctive. Missing a bracket is very easy to do if practitioners are not using an integrated developer environment which can pick up these kinds of minor mistakes automatically. In most R functions quotation marks are expected when an argument expects practitioners to choose from a set of text-based options. It is easy to forget a comma in a function.