data > opinion

Tom Alby

02 Daten importieren

2021-11-29


Zunächst laden Sie die Library Tidyverse, in der weitere Libraries enthalten sind:

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.3     ✓ purrr   0.3.4
## ✓ tibble  3.1.2     ✓ dplyr   1.0.6
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()

Passen Sie den Pfad an, je nachdem, wo Sie die die Daten gespeichert haben:

IMDb_movies <- read_csv("data/IMDb_movies.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   .default = col_character(),
##   year = col_double(),
##   duration = col_double(),
##   avg_vote = col_double(),
##   votes = col_double(),
##   metascore = col_double(),
##   reviews_from_users = col_double(),
##   reviews_from_critics = col_double()
## )
## ℹ Use `spec()` for the full column specifications.
## Warning: 1 parsing failure.
##   row  col expected        actual                   file
## 83918 year a double TV Movie 2019 'data/IMDb_movies.csv'

Lassen Sie sich die ersten Zeilen des Datensatzes anzeigen:

head(IMDb_movies)
## # A tibble: 6 x 22
##   imdb_title_id title original_title  year date_published genre duration country
##   <chr>         <chr> <chr>          <dbl> <chr>          <chr>    <dbl> <chr>  
## 1 tt0000009     Miss… Miss Jerry      1894 1894-10-09     Roma…       45 USA    
## 2 tt0000574     The … The Story of …  1906 1906-12-26     Biog…       70 Austra…
## 3 tt0001892     Den … Den sorte drøm  1911 1911-08-19     Drama       53 German…
## 4 tt0002101     Cleo… Cleopatra       1912 1912-11-13     Dram…      100 USA    
## 5 tt0002130     L'In… L'Inferno       1911 1911-03-06     Adve…       68 Italy  
## 6 tt0002199     From… From the Mang…  1912 1913           Biog…       60 USA    
## # … with 14 more variables: language <chr>, director <chr>, writer <chr>,
## #   production_company <chr>, actors <chr>, description <chr>, avg_vote <dbl>,
## #   votes <dbl>, budget <chr>, usa_gross_income <chr>,
## #   worlwide_gross_income <chr>, metascore <dbl>, reviews_from_users <dbl>,
## #   reviews_from_critics <dbl>