Рет қаралды 178,251
Changing Numeric Variable to Categorical (Transforming Data) in R: How to convert numeric Data to categories or factors in R deal with nonlinearity in linear regression and more. Free Practice Dataset (LungCapData) here: statslectures.com; More Statistics & R Programming Videos: goo.gl/4vDQzT
►► Like to support us? You can Donate (bit.ly/2CWxnP2), Share our Videos, Leave us a Comment and Give us a Thumbs up! Either way We Thank You!
In this R video tutorial we will learn to create a categorical variable (a factor or qualitative variable) from a numeric variable in R using the "cut" command (function). In this R video you will also learn how to label the categories and make the intervals left-closed or right-opened using the "labels" and "right" arguments.
Transforming data, converting a continuous variables into categorical variable or factors, is useful for making cross-tabulations for a variable, fitting a regression model when the linearity is not valid for the variable and more.
This video is a tutorial for programming in R Statistical Software for beginners, using RStudio.
■Table of Content:
0:00:08 Why should we convert a numeric variable into categorical variable or factors
0:00:44 How to use the "cut" command in R to convert a continuous variable into a categorical variable
0:00:53 How to access the help menu for the “cut” function in R programming language
0:01:21 How to specify the break points for the new categorical variable in R
0:01:51 How does R treat the border observations in a categorical variable
0:02:08 How to name or label the categories that we created in R using the “labels” argument
0:02:57 How to change the way R treats the border observation in a categorical variable so that the intervals are left-closed or right-opened using the "right" argument within the "cut" command.
0:03:33 How to label the categories in a categorical variable in R programming language
0:04:43 How to tell R to create a certain number of categories or levels rather than specifying the break points ourselves
► ► Watch More:
► Intro to Statistics Course: bit.ly/2SQOxDH
►Data Science with R bit.ly/1A1Pixc
►Getting Started with R (Series 1): bit.ly/2PkTneg
►Graphs and Descriptive Statistics in R (Series 2): bit.ly/2PkTneg
►Probability distributions in R (Series 3): bit.ly/2AT3wpI
►Bivariate analysis in R (Series 4): bit.ly/2SXvcRi
►Linear Regression in R (Series 5): bit.ly/1iytAtm
►ANOVA Concept and with R bit.ly/2zBwjgL
►Hypothesis Testing: bit.ly/2Ff3J9e
►Linear Regression Concept and with R Lectures bit.ly/2z8fXg1
Follow MarinStatsLectures
Subscribe: goo.gl/4vDQzT
website: statslectures.com
Facebook:goo.gl/qYQavS
Twitter:goo.gl/393AQG
Instagram: goo.gl/fdPiDn
Our Team:
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!