5 Tips for Learning R
Sep 26, 2022So you want to learn R? That's awesome! I love R, so I'm super excited to hear that!
While learning R is fun and exciting, it can also be a little challenging and frustrating. Here are my five tips for learning R.
First, make mistakes. Mistakes help you learn. Even though I’ve been coding and using R for many years, I consistently run into errors and make mistakes when I code. Just last week, I used the wrong operator when making a data viz and got an error (for R users, I used %>% instead of + to add on to a ggplot).
It does get easier to spot and fix mistakes over time. As you practice, you’ll get more of a sense for why a line of code is causing an error.
When you’re starting out and run into errors, here are a few things to try:
- Look at the documentation for the function you’re using - make sure you’re including the required arguments
- Check your parentheses - did you match all the opening parentheses with closing ones?
- Look in the Console section of RStudio - is there a > or a +? A > means R is ready for more code. A + means R needs more information to run the code. If you get stuck with a +, press ESC to get back to >.
- Copy and paste the error message into your favorite search engine to see how others have resolved a similar problem (sometimes it helps to add “R” or “RStats” to your error message search).
Second, experiment and try new things. There is so much to learn and do in R, and it can feel both exciting and a bit overwhelming. The more you experiment, the more you’ll learn.
Think about something you’d like to learn how to do in R and search for online tutorials (might I suggest the Schilling Data Studio YouTube playlist Learn R With Me or the Learn R With Me Blog Post Series).
When you’re searching online, use the formula “how to [insert thing you want to learn] in R” or “make/do [insert thing you want to learn] in R” to get the best results.
Third, find a community. Learning R is something we usually do in isolation in front of our computers, and it can feel lonely.
If you find a community of fellow learners or users of R, you can easily get help, share your progress, and celebrate your successes!
Want to find a community in your journey to learn R? Check out my virtual membership program Learn R With Me, a community for new R users to learn to code and find support. If you’re reading this in late September 2022, I’m launching this community with a free introduction to R mini-course - check it out!
Fourth, take your time. I don’t mean to say that learning R takes a lot of time, I more mean that you don’t have to figure it out all at once.
I also want you to take breaks - if you're feeling frustrated, step away for awhile. If you look up and realize (and this is a totally random example, not at all from personal experience...) you've been hunched over your computer for three hours and you're both dying of thirst and need to pee (I mean come on body, both at the same time!?), maybe get up, use the bathroom, get a drink of water, and take a walk.
Taking your time and learning R bit by bit will actually help you remember it later on. If you rush through a course or tutorial, you’ll most likely forget it by next week. But if you take it slow, learn a piece at a time, and practice what you’re learning, you’ll recall it better later on.
This is a nice segue into my last tip…
Fifth, practice on a topic you care about. It’s not very interesting to follow R tutorials on data you have no connection to. So, instead, my recommendation is to find a topic you care about and do your own project with it.
Not only are you going to be more engaged working on a project you care about, you’ll also learn more because you’ll have to figure out for yourself how to create a graph with your data or do the statistical analysis you’re interested in.
Here are some resources that you can use to find datasets:
- Interesting Datasets
- Data is Plural
- Tidy Tuesday
- 10 sources for free datasets
- Kaggle
- 21 places to find free datasets
- Viz for Social Good
You can also collect data about yourself and create visualizations or analyses based on that. Personally, I track my reading each year and make a data viz out of it in R. I've also collected my water and tea intake during a week and created a visualization. What could you collect data on about yourself?
I hope you enjoyed my five tips for learning R! Subscribe to the Schilling Data Studio newsletter to be the first to know about new posts, videos, and programs.
Stay connected with news and updates!
Join our mailing list to receive the latest news and updates from our team.
Don't worry, your information will not be shared.
We hate SPAM. We will never sell your information, for any reason.