Subsetting (Sort/Select) Data with Square Brackets and Logic Statements in R; Learn how to sort through the variables and observations and extract only the data that you need? Practice with Free (LungCap) Dataset: ( 👍🏼Best Statistics & R Programming Language Tutorials: ( )
►► Like to support us? You can Donate ( Share our Videos, Leave us a Comment and Give us a Like or Write us a Review! Either way We Thank You!
When working with a large data set, you might only be interested in a small portion of it. How do you sort through all the variables and observations and extract only the data that you need? R has several ways of sorting and selecting data in a process that is called “subsetting.” Brackets in R lets you select, or subset, data from a vector, matrix, array, list or data frame.
R’s operators can be summarized as:
• [ for subsets,
• [[ for extracting items, and
• $ for extracting by name.
In this R tutorial video, we focus on subsetting data from a vector and matrix in R.
►►Download the LungCap dataset here:
►R Tutorials for Data Science
►Starting with R Tutorial
►Graphs and Descriptive Statistics in R:
►Probability Distributions in R:
►Bivariate Analysis in R:
►Linear Regression in R:
►Intro to Statistics Course:
◼︎ Table of Content
0:00:19 How to ask R programming language the dimensions of the data? using the “dim” or dimensions function
0:00:31 How to ask R about the number of observations in a vector or variable? using the “length” function
0:00:41 How to use square brackets to extract part of the data from a vector in R
0:01:10 How to extract (subset) data from a matrix or data frame in R (step by step examples)
0:01:36 The difference between “equal sign” (=) and “double equal sign” (==) in R Software
0:03:25 How to pull out a subset of data from a dataset in R: step by step example
This video is a tutorial for programming in R Statistical Software for beginners, using RStudio.
Content Creator: Mike Marin (B.Sc., MSc.) Senior Instructor at UBC.
Producer and Creative Manager: Ladan Hamadani (B.Sc., BA., MPH)
These videos are created by #marinstatslectures to support some courses at The University of British Columbia (UBC) (#IntroductoryStatistics and #RVideoTutorials for Health Science Research), although we make all videos available to the everyone everywhere for free.
Thanks for watching! Have fun and remember that statistics is almost as beautiful as a unicorn!