Movie Rating

Load library

library(RMySQL)
## Loading required package: DBI

Connect to database

mydb = dbConnect(MySQL(), user=‘xxx’, password=‘xxx’, dbname=‘sys’, host=‘localhost’)

and query the data

rs <- dbGetQuery(mydb, "select ID, title, releaseDate, miniRate, review, imgurl from  movierating")

Print data in table with images.

  rs$imgurl <- sprintf("![](%s){width=100px}", rs$imgurl)

  




library(knitr  )

kable(rs)
ID title releaseDate miniRate review imgurl
1 The Adventurers (2017) 2017-08-18 00:00:00 Not Yet Rated 6.3
2 The Nut Job 2: Nutty by Nature 2017-08-11 00:00:00 PG 4.0
3 A taxi driver(2017) 2017-08-18 00:00:00 Not Yet Rated 7.0
4 The Emoji Movie 2017-08-18 00:00:00 Not Yet Rated 2.0
5 Lady Macbeth 2017-07-14 00:00:00 R 4.0
6 Transformers: The Last Knight 2017-06-21 00:00:00 PG-13 2.0

Code Reference: https://stackoverflow.com/questions/25106481/add-an-image-to-a-table-like-output-in-r

https://sebastiansauer.github.io/figure_sizing_knitr/