2.4 BASICS OF CODING IN R
With R, as with Python, you execute a command which generates output. Much of the structure of R code will feel similar to Python code, with a few important differences. In this section we discuss the five kinds of programming actions we previously covered using Python, this time using R: Using comments, Importing packages, Executing commands, Saving output, and Getting data into Python.
2.4.1 Using Comments in R
The use of comments is just as important for coding in R as they are for coding in Python. Comments allow you to describe what the code does and other vital information.
Comments are lines of code which begin with a pound sign, #, such as the code below.
# This is a comment, and won’t be compiled by R!
Remember that R code will be presented in boldface throughout this text. Do not be afraid of putting comments in your code, even when not prompted by the examples and exercises in this text. Use the tool to keep your code as clear and understandable...