November 2018
Beginner to intermediate
354 pages
6h 59m
English
Suppose, we also have the prices of these three items for the month of June as follows:
june_price = c(20, 25, 33)
Now if we want to stack all these three months in a single variable, we can't use vectors anymore; we need a new data structure. One of the data structures to rescue in this case is the matrix. A matrix is basically a two-dimensional array of data elements with a number of rows and columns fixed. Like a vector, a matrix can also contain just one type of element; a mix of two types is not allowed. To combine these three vectors with every row corresponding to a particular month's prices of different items and every column corresponding to prices of different items in a particular month, what we can do is first combine ...
Read now
Unlock full access