Загрузка страницы

Data Science & Statistics: Creating a Matrix in R

👉🏻 Download Our Free Data Science Career Guide: https://bit.ly/3gbc0dh
👉🏻 Sign up for Our Complete Data Science Training with 57% OFF: https://bit.ly/34aW2gM

What are matrices:

1. When it comes to storing data, matrices are a natural extension to vectors: while vectors are 1-dimensional collections of data, matrices are two-dimensional arrays;
2. Matrices have a fixed number of rows and columns;
3. Matrices, same as vectors, can contain only one basic data type. This makes sense: you create a matrix from a vector. You can think of it as curving the vector into rows or columns, and just as a vector can only store doubles, or characters, or logicals, and so on, so can a matrix.

There are two methods for creating a matrix in R. The matrix() function, and the rbind() and cbind() functions.

matrix() takes at least two arguments: a vector it can structure into a matrix, and an argument specifying the number of rows the new object must have, called nrow. Alternatively, you can pass the number of columns you want your matrix to have, by specifying ncol.

When creating the matrix, R fills out the first column first, then moves on to the second, and so on. To organize your data by rows, use the byrow argument in the matrix() function, and set it to TRUE instead of its default FALSE.

Using rbind and cbind to create a matrix. Rbind stands for row bind, and cbind for column bind.

Naming the components of a matrix is just like naming a vector but instead of the names() function, matrices recognise the colnames() and rownames() functions.

► Consider hitting the SUBSCRIBE button if you LIKE the content: https://www.youtube.com/c/365DataScience?sub_confirmation=1

► VISIT our website: https://bit.ly/365ds

🤝 Connect with us LinkedIn: https://www.linkedin.com/company/365datascience/

365 Data Science is an online educational career website that offers the incredible opportunity to find your way into the data science world no matter your previous knowledge and experience. We have prepared numerous courses that suit the needs of aspiring BI analysts, Data analysts and Data scientists.

We at 365 Data Science are committed educators who believe that curiosity should not be hindered by inability to access good learning resources. This is why we focus all our efforts on creating high-quality educational content which anyone can access online.

Check out our Data Science Career guides: https://www.youtube.com/playlist?list=PLaFfQroTgZnyQFq4nUfb-w2vEopN3ULMb

#Matrix #DataScience #Statistics

Видео Data Science & Statistics: Creating a Matrix in R канала 365 Data Science
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
27 апреля 2018 г. 17:27:41
00:06:59
Яндекс.Метрика