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

Data Science & Statistics: Indexing an element from a matrix

👉🏻 Download Our Free Data Science Career Guide: https://bit.ly/2EdpgRl
👉🏻 FREE MONTH! Get full access to our newly redesigned platform and all our courses (18th October - 18th November): https://bit.ly/3ga3g6Y

Learn how to select and extract single and multiple values from a matrix in R. Extracting a value from a matrix happens with square brackets, and the values you want extracted in them. If you’re working with more-dimensional objects, think of R’s extraction schema as looking like this: [ , ].

If we want to extract a row from a matrix, we should type row number, COMMA, and use a blank space to indicate that you want every value on that row.

The exact same logic applies to extracting an entire column from a matrix, but this time, the comma precedes the column index.

Selecting multiple elements.

When talking about vector slicing we learned that we can just pass a vector in the square brackets that indexes the multiple elements we want to extract. The same rule applies to matrices. For example, to select the 1st, 3rd, and 7th rows, all we need to do is open square brackets, pass in a vector of indexes where the rows element is – close the parentheses – comma, and close the square brackets.

We can subset matrices using the column names, and row names, too.

To extract a named row from a matrix, pass in the name of the row, and leave the space for columns blank.

► 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

#DataScience #Statistics #RProgramming

Видео Data Science & Statistics: Indexing an element from a matrix канала 365 Data Science
Показать
Комментарии отсутствуют
Введите заголовок:

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

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

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