@RProgramming101

Get my FREE cheat sheets for R programming and statistics (including transcripts of these lessons) here: https://www.learnmore365.com/pages/membership-r-programming-data-visualization-and-research-methods

@richieeniks3711

You are a great teacher!!! Thank you man! God bless you....Cheers

@EmersonScheidegger

Your content submission is amazing!!! please, keep going!

@hjafet9696

Thank you! Greetings from Mexico.

@neytchi8709

Your content submission is rocket!

@2012Opus

Thank you!  The only confusing this the  final argument: TRUE ~.  This is a bit counterintuitive.....

@RUJedi

Fantastic video as always.  However, why use if_else() from dplyr when there is ifelse() from base R?  

Sure, if_else() has an extra argument option for processing missing values, that could still be handled with the base R version without much effort too.  Sometimes I think the Tidyverse over-complicates code by offering more code choices when the base R version is equivalent or nearly as good.

@NattyGism

πŸŽ‰ always love every post and always looking forward to more. Thank Greg# R_ Super hero πŸ¦ΈπŸ½β€β™‚οΈ
Very helpful.

@Kirsty-o3r

This is so helpful, thank you! Can you use this approach prior to imputation of missing values in cases where you have conditional responses? E.g., in survey data certain questions may not be relevant for some participants and thus, they will not need to provide responses to a select portion of the survey. In these cases, it would be necessary to ignore their non-response and only impute data for other individuals.

@maizeblue699

I've had issues with if_else() being more restrictive with outputs and have switched to ifelse().

Let's say you want to output either a character or a number depending on your condition. For example, I want to convert all my 0 values (considering them as below LOQ) in variable_1 to "NA" and leave the rest as numeric values so I ca then use "na.exclude()":

mutate(variable_2 = if_else(variable_1 == 0, "NA", variable_2) will give me an error.

This same code works if I use "ifelse()" instead.

I was initially using embedded if else statements and eventually realized case_when is a lot more compact.

@jackymo820

In the case_when example, both FALSE actions (when the 2 conditions were not met) were the same (putting original hair colour)

what if the FALSE action of the 2 conditions is different?

@ampauls

Fantastic. I'm curious then, if you like the table you've made, and want to use it in a paper or presentation, how do you export that? Is it simply copy and paste, or is there a command we can use to export the table?