# install.packages("tidyverse")
# install.packages("here")
library(tidyverse)
library(here)
## Load the data
<- readRDS(file = here::here("raw_data", "characters.rds"))
characters <- read.csv(
psych_stats file = here::here("raw_data", "psych_stats.csv"),
sep = ";"
)
Getting an Overview: Exercises
Exercise 1
Take a look at the characters
data set.
- How many rows and how many columns does the data frame have?
Hint
Use str()
.
Solution
str(characters)
'data.frame': 889 obs. of 7 variables:
$ id : chr "F2" "F1" "F5" "F4" ...
$ name : chr "Monica Geller" "Rachel Green" "Chandler Bing" "Joey Tribbiani" ...
$ uni_id : chr "F" "F" "F" "F" ...
$ uni_name : chr "Friends" "Friends" "Friends" "Friends" ...
$ notability: num 79.7 76.7 74.4 74.3 72.6 51.6 86.5 84.2 82.6 65.6 ...
$ link : chr "https://openpsychometrics.org/tests/characters/stats/F/2" "https://openpsychometrics.org/tests/characters/stats/F/1" "https://openpsychometrics.org/tests/characters/stats/F/5" "https://openpsychometrics.org/tests/characters/stats/F/4" ...
$ image_link: chr "https://openpsychometrics.org/tests/characters/test-resources/pics/F/2.jpg" "https://openpsychometrics.org/tests/characters/test-resources/pics/F/1.jpg" "https://openpsychometrics.org/tests/characters/test-resources/pics/F/5.jpg" "https://openpsychometrics.org/tests/characters/test-resources/pics/F/4.jpg" ...
The data frame has 889 rows and 7 columns.
- What show are the first characters in the data frame from?
Hint
Use head()
.
Solution
head(characters)
id name uni_id uni_name notability
1 F2 Monica Geller F Friends 79.7
2 F1 Rachel Green F Friends 76.7
3 F5 Chandler Bing F Friends 74.4
4 F4 Joey Tribbiani F Friends 74.3
5 F3 Phoebe Buffay F Friends 72.6
6 F6 Ross Geller F Friends 51.6
link
1 https://openpsychometrics.org/tests/characters/stats/F/2
2 https://openpsychometrics.org/tests/characters/stats/F/1
3 https://openpsychometrics.org/tests/characters/stats/F/5
4 https://openpsychometrics.org/tests/characters/stats/F/4
5 https://openpsychometrics.org/tests/characters/stats/F/3
6 https://openpsychometrics.org/tests/characters/stats/F/6
image_link
1 https://openpsychometrics.org/tests/characters/test-resources/pics/F/2.jpg
2 https://openpsychometrics.org/tests/characters/test-resources/pics/F/1.jpg
3 https://openpsychometrics.org/tests/characters/test-resources/pics/F/5.jpg
4 https://openpsychometrics.org/tests/characters/test-resources/pics/F/4.jpg
5 https://openpsychometrics.org/tests/characters/test-resources/pics/F/3.jpg
6 https://openpsychometrics.org/tests/characters/test-resources/pics/F/6.jpg
They are from Friends.