library(datos)
## Warning: package 'datos' was built under R version 3.5.3
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 3.5.3
## -- Attaching packages ----------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.2.1     v purrr   0.3.3
## v tibble  2.1.3     v dplyr   0.8.4
## v tidyr   1.0.2     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.4.0
## Warning: package 'ggplot2' was built under R version 3.5.3
## Warning: package 'tibble' was built under R version 3.5.3
## Warning: package 'tidyr' was built under R version 3.5.3
## Warning: package 'readr' was built under R version 3.5.3
## Warning: package 'purrr' was built under R version 3.5.3
## Warning: package 'dplyr' was built under R version 3.5.3
## Warning: package 'stringr' was built under R version 3.5.3
## Warning: package 'forcats' was built under R version 3.5.3
## -- Conflicts -------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
ggplot(data=millas) +
geom_point(mapping=aes(x=motor, y=autopista))

filter (millas, cilindros==8)
## # A tibble: 70 x 11
##    fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##    <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
##  1 audi       a6 qu~   4.2  2008         8 auto(s6)    4            16        23
##  2 chevrolet  c1500~   5.3  2008         8 auto(l4)    t            14        20
##  3 chevrolet  c1500~   5.3  2008         8 auto(l4)    t            11        15
##  4 chevrolet  c1500~   5.3  2008         8 auto(l4)    t            14        20
##  5 chevrolet  c1500~   5.7  1999         8 auto(l4)    t            13        17
##  6 chevrolet  c1500~   6    2008         8 auto(l4)    t            12        17
##  7 chevrolet  corve~   5.7  1999         8 manual(m6)  t            16        26
##  8 chevrolet  corve~   5.7  1999         8 auto(l4)    t            15        23
##  9 chevrolet  corve~   6.2  2008         8 manual(m6)  t            16        26
## 10 chevrolet  corve~   6.2  2008         8 auto(s6)    t            15        25
## # ... with 60 more rows, and 2 more variables: combustible <chr>, clase <chr>
filter (millas, anio==1999)
## # A tibble: 117 x 11
##    fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##    <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
##  1 audi       a4       1.8  1999         4 auto(l5)    d            18        29
##  2 audi       a4       1.8  1999         4 manual(m5)  d            21        29
##  3 audi       a4       2.8  1999         6 auto(l5)    d            16        26
##  4 audi       a4       2.8  1999         6 manual(m5)  d            18        26
##  5 audi       a4 qu~   1.8  1999         4 manual(m5)  4            18        26
##  6 audi       a4 qu~   1.8  1999         4 auto(l5)    4            16        25
##  7 audi       a4 qu~   2.8  1999         6 auto(l5)    4            15        25
##  8 audi       a4 qu~   2.8  1999         6 manual(m5)  4            17        25
##  9 audi       a6 qu~   2.8  1999         6 auto(l5)    4            15        24
## 10 chevrolet  c1500~   5.7  1999         8 auto(l4)    t            13        17
## # ... with 107 more rows, and 2 more variables: combustible <chr>, clase <chr>
filter(millas, fabricante=="chevrolet")
## # A tibble: 19 x 11
##    fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##    <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
##  1 chevrolet  c1500~   5.3  2008         8 auto(l4)    t            14        20
##  2 chevrolet  c1500~   5.3  2008         8 auto(l4)    t            11        15
##  3 chevrolet  c1500~   5.3  2008         8 auto(l4)    t            14        20
##  4 chevrolet  c1500~   5.7  1999         8 auto(l4)    t            13        17
##  5 chevrolet  c1500~   6    2008         8 auto(l4)    t            12        17
##  6 chevrolet  corve~   5.7  1999         8 manual(m6)  t            16        26
##  7 chevrolet  corve~   5.7  1999         8 auto(l4)    t            15        23
##  8 chevrolet  corve~   6.2  2008         8 manual(m6)  t            16        26
##  9 chevrolet  corve~   6.2  2008         8 auto(s6)    t            15        25
## 10 chevrolet  corve~   7    2008         8 manual(m6)  t            15        24
## 11 chevrolet  k1500~   5.3  2008         8 auto(l4)    4            14        19
## 12 chevrolet  k1500~   5.3  2008         8 auto(l4)    4            11        14
## 13 chevrolet  k1500~   5.7  1999         8 auto(l4)    4            11        15
## 14 chevrolet  k1500~   6.5  1999         8 auto(l4)    4            14        17
## 15 chevrolet  malibu   2.4  1999         4 auto(l4)    d            19        27
## 16 chevrolet  malibu   2.4  2008         4 auto(l4)    d            22        30
## 17 chevrolet  malibu   3.1  1999         6 auto(l4)    d            18        26
## 18 chevrolet  malibu   3.5  2008         6 auto(l4)    d            18        29
## 19 chevrolet  malibu   3.6  2008         6 auto(s6)    d            17        26
## # ... with 2 more variables: combustible <chr>, clase <chr>
filter(millas, modelo=="malibu" )
## # A tibble: 5 x 11
##   fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##   <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
## 1 chevrolet  malibu   2.4  1999         4 auto(l4)    d            19        27
## 2 chevrolet  malibu   2.4  2008         4 auto(l4)    d            22        30
## 3 chevrolet  malibu   3.1  1999         6 auto(l4)    d            18        26
## 4 chevrolet  malibu   3.5  2008         6 auto(l4)    d            18        29
## 5 chevrolet  malibu   3.6  2008         6 auto(s6)    d            17        26
## # ... with 2 more variables: combustible <chr>, clase <chr>
filter(millas, modelo=="malibu", anio==1999 )
## # A tibble: 2 x 11
##   fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##   <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
## 1 chevrolet  malibu   2.4  1999         4 auto(l4)    d            19        27
## 2 chevrolet  malibu   3.1  1999         6 auto(l4)    d            18        26
## # ... with 2 more variables: combustible <chr>, clase <chr>
filter(millas, modelo=="a4", anio==1999 )
## # A tibble: 4 x 11
##   fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##   <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
## 1 audi       a4       1.8  1999         4 auto(l5)    d            18        29
## 2 audi       a4       1.8  1999         4 manual(m5)  d            21        29
## 3 audi       a4       2.8  1999         6 auto(l5)    d            16        26
## 4 audi       a4       2.8  1999         6 manual(m5)  d            18        26
## # ... with 2 more variables: combustible <chr>, clase <chr>
filter(millas, modelo=="a4", anio==1999, cilindros==4 )
## # A tibble: 2 x 11
##   fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##   <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
## 1 audi       a4       1.8  1999         4 auto(l5)    d            18        29
## 2 audi       a4       1.8  1999         4 manual(m5)  d            21        29
## # ... with 2 more variables: combustible <chr>, clase <chr>
filter(millas, motor==2.8)
## # A tibble: 10 x 11
##    fabricante modelo motor  anio cilindros transmision traccion ciudad autopista
##    <chr>      <chr>  <dbl> <int>     <int> <chr>       <chr>     <int>     <int>
##  1 audi       a4       2.8  1999         6 auto(l5)    d            16        26
##  2 audi       a4       2.8  1999         6 manual(m5)  d            18        26
##  3 audi       a4 qu~   2.8  1999         6 auto(l5)    4            15        25
##  4 audi       a4 qu~   2.8  1999         6 manual(m5)  4            17        25
##  5 audi       a6 qu~   2.8  1999         6 auto(l5)    4            15        24
##  6 volkswagen gti      2.8  1999         6 manual(m5)  d            17        24
##  7 volkswagen jetta    2.8  1999         6 auto(l4)    d            16        23
##  8 volkswagen jetta    2.8  1999         6 manual(m5)  d            17        24
##  9 volkswagen passat   2.8  1999         6 auto(l5)    d            16        26
## 10 volkswagen passat   2.8  1999         6 manual(m5)  d            18        26
## # ... with 2 more variables: combustible <chr>, clase <chr>