# A tibble: 0 × 6
# ℹ 6 variables: country <fct>, continent <fct>, year <int>, lifeExp <dbl>,
# pop <int>, gdpPercap <dbl>
2024-02-08
How do I … ?
Why did R do X when I wanted it to do Y?
My code doesn’t work!
Help!!
There are many ways to approach a task
You need to figure out how to describe what you want to accomplish and how to do it
You need to evaluate your decisions – is that hard-won figure effective?
You need a strategy for making notes and building your own knowledge
Even small errors can be hard to find and cause a lot of frustration
Finding and fixing mistakes
Learning from examples
Remembering what you learned before
Learning something new
Asking questions
# A tibble: 24 × 6
country continent year lifeExp pop gdpPercap
<fct> <fct> <int> <dbl> <int> <dbl>
1 Canada Americas 1952 68.8 14785584 11367.
2 Canada Americas 1957 70.0 17010154 12490.
3 Canada Americas 1962 71.3 18985849 13462.
4 Canada Americas 1967 72.1 20819767 16077.
5 Canada Americas 1972 72.9 22284500 18971.
6 Canada Americas 1977 74.2 23796400 22091.
7 Canada Americas 1982 75.8 25201900 22899.
8 Canada Americas 1987 76.9 26549700 26627.
9 Canada Americas 1992 78.0 28523502 26343.
10 Canada Americas 1997 78.6 30305843 28955.
# ℹ 14 more rows
Look in the Examples section of ?geom_line
How do I change the x and y axis labels?
Google search. Add “R” to your search.
Know which sites you like to read
Learn to read documentation – more condensed information
Make notes for yourself
How do I set the limits, tick marks, and numbering on an axis?
ggplot2 tidyverse “Scales”: xlim
, ylim
Search.
theme
scale_x_discrete(name, breaks, labels, limits)
scale_x_continuous(name, breaks, lables, limits, trans)
Try an example from the help page (or internet)
Read a bit of ?c
(combine values into a vector or list).
You are still stuck.
How do you ask for help?
I’ve made a list of many of functions that I use in the first few weeks of the course, and the package you need for each, and put them in the course notes under “R Review”.
Learning computing skills is a never-ending task
Using reference material, blogs, and books is a learned skill that you can get better at
Try different sources until you learn what you like to learn from the most (and sometimes try other sources)
Asking questions is a valuable skill. Clearly expressing your question so that someone else can read it will often help you solve the problem by yourself.
It gets easier with practice: posing questions, understanding the answers, and remembering how it all fits together
Assignment 2 asks you to learn some new skills and describe what you learned.