Before we start any serious programming in R, we need to learn how to import data into an R environment and which data types R supports. Often, for a particular analysis, we will not use the entire dataset. Therefore, we need to also learn how to select a subset of the data for any analysis. This section will cover these aspects.
R has five basic data types as follows:
The default representation of numbers in R is double precision real number (numeric). If you want an integer representation explicitly, you need to add the suffix
L. For example, simply entering
1 on the command prompt will store
1 as a numeric object. To store
1 as an integer, you need to enter ...