Working with factors and categorical variables. Use forcats in R programming to change factor levels
HTML-код
- Опубликовано: 6 фев 2025
- R programming for beginners just got easier. If you're working with categorical variables or factors (as they are called in R) then you'll love the forcats package. Forcats lets you change factor levels in a number of exciting ways. If you are learning R programming, then you'll find this tremendously useful for anything related to categorical variables - be it data visualization, working with tables, doing a chi-squared test and more.
This channel is supported by Nested Knowledge - an online platform that supports the entire literature review process. Please do check them out at this link: about.nested-k...?&RPYT
Get my FREE cheat sheets for R programming and statistics (including transcripts of these lessons) here: www.learnmore365.com/courses/rprogramming-resource-library
Zooming in so we can watch on our phones is just one example of your fabulousness, you are the absolute GURU of R tutorials!
So nice of you - thanks for the great feedback!
I swear you're unbelievably talented at all levels of creating content
So nice of you - thanks for the great feedback!
The zoomed in text for cell phone viewers is such a nice touch! 👌 One if my favorite ways to consume your content!
Glad you enjoy it! Thank you for the feedback!
I can't but say, Greg, I admire you a lot.
Thanks for this comprehensive and step-by-step video for us.
Fabulous !!! Just excellent. You have been absolute savior! Thank you very much.
Glad it was helpful! Thank you :)
the most amazing video ever , i just love all your videos
Thanks for the great feedback Karen. Much appreciated!!
Very helpful, invaluable programming.Keep more coming
More to come! Glad it was helpful! ☺
Really detailed and useful tutorial. Thanks a lot
Glad it was helpful! Thank you for your feedback!
Just found your channel. Very helpful . Thank you
Glad it was helpful! You're welcome :)
Thank you for this amazing channel!
Thank you too! Glad you enjoyed it!
Thank you. It's very easy to follow.
Glad it was helpful! Thank you!
Great videos. Thank you
Glad you like them! Thanks
Fabulous teacher!!! Could you please show us how to add the numbers to the bar charts?
THANKYOU SO MUCH!!!!!!
super useful in visualization!!
Glad to hear that!
Thanks. This is great. But I was not able to make it work for my case. I have a stacked barplot with 3 categories (A,B,C) for each X and want to order by decreasing % of A regardless the other 2 values. Also, can you filter and sort the x factor in a certaing way and then save it/keep this way and use for the unfiltered data. Thanks a lot. Awesome content.
Really helpful. Thanks!
Glad to hear it! Thank you for your feedback!
Learned a lot thanks
when you use 'mutate(.)' (at minute: 20:17), does the original data change accordingly? so on the gss_cat %>% View() we will be seeing column 'partyid' in 4 categories instead of so many (i think about 10 categories)?
The following command doesn't work for me
gss_cat %>%
select(race) %>%
table()
it says "Error in select(., race) : unused argument (race)"
However, changing it to the next command solve the problem, and I get the same output as in your video:
gss_cat %>%
pull(race) %>%
table()
I need to change my text-based factors into numerical values and am having a hard time finding how to do this. Could someone give me some guidance to a video or blog? I need this in order to run some correlations and regressions.
¡Thanks this content expand the universe of r !
Thanks for watching and you are welcome!
Wonderful
Thank you! Cheers!
This si helpful. Thanks so much. Please any videos on how to average scores on a multi-item scale? Is there anyway of reaching you for further questions? Thanks.
I was thinking the same. I guess not 😂
Very much explained.goood
Afrika.kenya
Glad you liked it
Thank you so much!
You're welcome!
How could you get the exact number of a bar in these charts? What i mean is, you got the count at the y axis and you see approximately what the count is. Let’s say it is between 15.000 and 10.000 but you cannot tell the exact number. Is there any function to show either the exact number of the bar in/on the bar itself or to make the y axis with more detail so it is shown like this: 15.000 , 14.900, 14.800 …..
Make a playlist regarding geo-density in mapping
Great suggestion! Thanks
I now get forcats
Great!
I am getting you Loud and clear here in afrika place called kenya .world have become a small village really
I've been to Kenya - what a lovely country. Say hello to your fellow countrymen for me please
@@RProgramming101
Welcome. I will greet all for you.Your teaching will go a long way if u didn't know.welcome
I have a small query can you help me with that. Please
I have seen all you videos and always recommend you, will be thankful if you all me get out of this issue
Don't quite get the difference between select (race) and pull (race)
@Jacky Mo, He actually explained it, using SELECT will extract the race column as a DATA.FRAME, whereas using PULL will extract it as a FACTOR type which is the desired outcome in this case.
@@souhaibsebbane5623 thanks. so we need to memorise which function takes data.frame which takes factor. Are there any tips on that?
Thank you so much!
Glad it helped!