library(pacman)
p_load(ggplot2movies, tidyverse)
head(movies)
## # A tibble: 6 x 24
## title year length budget rating votes r1 r2 r3 r4 r5 r6
## <chr> <int> <int> <int> <dbl> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 $ 1971 121 NA 6.4 348 4.5 4.5 4.5 4.5 14.5 24.5
## 2 $100… 1939 71 NA 6 20 0 14.5 4.5 24.5 14.5 14.5
## 3 $21 … 1941 7 NA 8.2 5 0 0 0 0 0 24.5
## 4 $40,… 1996 70 NA 8.2 6 14.5 0 0 0 0 0
## 5 $50,… 1975 71 NA 3.4 17 24.5 4.5 0 14.5 14.5 4.5
## 6 $pent 2000 91 NA 4.3 45 4.5 4.5 4.5 14.5 14.5 14.5
## # … with 12 more variables: r7 <dbl>, r8 <dbl>, r9 <dbl>, r10 <dbl>,
## # mpaa <chr>, Action <int>, Animation <int>, Comedy <int>, Drama <int>,
## # Documentary <int>, Romance <int>, Short <int>
movies %>% select(starts_with("m"), starts_with("r"))
## # A tibble: 58,788 x 13
## mpaa rating r1 r2 r3 r4 r5 r6 r7 r8 r9 r10
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 "" 6.4 4.5 4.5 4.5 4.5 14.5 24.5 24.5 14.5 4.5 4.5
## 2 "" 6 0 14.5 4.5 24.5 14.5 14.5 14.5 4.5 4.5 14.5
## 3 "" 8.2 0 0 0 0 0 24.5 0 44.5 24.5 24.5
## 4 "" 8.2 14.5 0 0 0 0 0 0 0 34.5 45.5
## 5 "" 3.4 24.5 4.5 0 14.5 14.5 4.5 0 0 0 24.5
## 6 "" 4.3 4.5 4.5 4.5 14.5 14.5 14.5 4.5 4.5 14.5 14.5
## 7 "R" 5.3 4.5 0 4.5 4.5 24.5 24.5 14.5 4.5 4.5 14.5
## 8 "" 6.7 4.5 4.5 4.5 4.5 4.5 14.5 14.5 14.5 4.5 14.5
## 9 "" 6.6 4.5 4.5 4.5 0 0 0 34.5 14.5 4.5 24.5
## 10 "" 6 4.5 0 4.5 4.5 4.5 44.5 14.5 4.5 4.5 4.5
## # … with 58,778 more rows, and 1 more variable: Romance <int>
irisImperial<- iris %>% mutate(Species = toupper(Species),
Sepal.Width = Sepal.Width/2.5,
Sepal.Length = Sepal.Length/2.5,
Petal.Width = Petal.Width/2.5,
Petal.Length = Petal.Length/2.5)
head(irisImperial)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 2.04 1.40 0.56 0.08 SETOSA
## 2 1.96 1.20 0.56 0.08 SETOSA
## 3 1.88 1.28 0.52 0.08 SETOSA
## 4 1.84 1.24 0.60 0.08 SETOSA
## 5 2.00 1.44 0.56 0.08 SETOSA
## 6 2.16 1.56 0.68 0.16 SETOSA