In this tutorial, we will learn how to convert numerical or continuous variable into categorical variable. We will start with the simple example converting a numerical variable into a categorical variable with just two levels. And then we will see an example of converting a … [Read more...] about How to Convert Numerical Variable into a Categorical Variable in R
rstats101
dplyr if_else(): Create new variable from existing variable
With dplyr's if_else() function, we can create a new variable based on the values of another variable. if_else() function in dplyr takes in a condition as input and can assign a value based on the condition is true or false. In this example, we will use dplyr's if_else() to … [Read more...] about dplyr if_else(): Create new variable from existing variable