Working with data is an obvious requirement for data science professionals. The building blocks of working with data include understanding the most common data structures and how they are interrelated. In this guide, you will learn the techniques of programming matrices, lists, and arrays in R.

Vectors

It’s important to understand the concept of vectors before moving ahead.

A vector is the most common data structure in R. It is a sequence of elements of the same basic type. The vector() function can be used to create a vector. The default mode is logical, but we can use constructors such as character(), numeric(), etc., to create a vector of a specific type.

The lines of code below construct a numeric and a logical vector, respectively. A vector can also contain strings, as shown by the vector s.

#data-analysis #r

Programming R Matrices, Lists, and Arrays
1.85 GEEK