Chapter 2The R Basics

Package(s): gdata, foreign, MASS, e1071

2.1 Introduction

A better way of becoming familiar with a software is to start with simple and useful programs. In this chapter, we aim to make the reader feel at home with the R software. The reader often struggles with the syntax of a software, and it is essentially this shortcoming that the reader will overcome after going through the later sections. It should always be remembered that it is not just the beginner, even the experts make mistakes when it comes to the structure of the syntax, and this is probably the reason why the “Backspace” key on the keyboard is always there, apart from many other keys round about for correcting previously submitted commands and/or programs.

Section 2.2 begins with the R preliminaries. The main topics considered here discuss and illustrate using R for finding absolute values, remainders, rounding numbers to specified number of digits, basic arithmetic, etc. Trigonometric functions and complex numbers are considered too, and the computations of factors and combinatorics is dealt with in this section. Useful R functions are then dealt with in Section 2.3. Summary of R objects, deliberating on the type of the R class, dealing with missing observations, and basic control options for writing detailed R programs have been addressed here. The importance of vectors and matrices are almost all prevalent in data analysis, and forms the major content of Section 2.4. Importing data from ...

Get A Course in Statistics with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.