since I am using mysql to store data, I use the Rmysql package
library(RMySQL)
## Warning: package 'RMySQL' was built under R version 3.2.5
## Loading required package: DBI
con <- dbConnect(MySQL(),
user='root', password='con0firm', dbname='movie', host='localhost')
dbListTables(con)
## [1] "movie"
sql <- "select * from movie"
res <- dbGetQuery(con, sql)
df <- data.frame(res)
df
## name relationship Doctor_Strange Wonder_Woman Alien_Covenant
## 1 Andy Lu Brother 5 2 3
## 2 Cong Lu Father 4 4 2
## 3 Edwin Leaung Friend 5 4 4
## 4 Jay Li Friend 4 5 3
## 5 Ming Ye Mother 3 3 4
## The_Hitmans_Bodyguard Dunkirk Guardians_of_the_Galaxy_Vol2
## 1 3 4 5
## 2 3 3 3
## 3 5 4 5
## 4 3 5 2
## 5 4 4 4