Tarea clase 2

1 Imprimir la base movielens sin los NA

#install.packages("DT")
library(DT)
library(dslabs)

data("movielens")
head(movielens)
##   movieId                                   title year
## 1      31                         Dangerous Minds 1995
## 2    1029                                   Dumbo 1941
## 3    1061                                Sleepers 1996
## 4    1129                    Escape from New York 1981
## 5    1172 Cinema Paradiso (Nuovo cinema Paradiso) 1989
## 6    1263                        Deer Hunter, The 1978
##                             genres userId rating  timestamp
## 1                            Drama      1    2.5 1260759144
## 2 Animation|Children|Drama|Musical      1    3.0 1260759179
## 3                         Thriller      1    3.0 1260759182
## 4 Action|Adventure|Sci-Fi|Thriller      1    2.0 1260759185
## 5                            Drama      1    4.0 1260759205
## 6                        Drama|War      1    2.0 1260759151
vec_logico <- is.na(movielens$year)

NA_movielens <- subset(movielens, !vec_logico) #la función subset() permite filtrar según una condición
datatable(NA_movielens)
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html

2 Almacenar en un Data frame las películas que tienen rating menor a 3.544 (promedio)

NO_ver <- subset(movielens, movielens$rating < 3.544)
datatable(NO_ver)
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html