library(htmltools)
# Define video information, including links, views, and likes
videos <- data.frame(
Link = c(
"https://ads.admetricks.com/video_26c1ffc5498c2af3b2ef7e24ef059475.mp4",
"https://ads.admetricks.com/video_6eb0fd9b8ff3180c4f03f1249204206e.mp4"
),
Views = c(10000, 15000), # Replace with actual view counts
Likes = c(500, 700) # Replace with actual like counts
)
# Create HTML code to embed videos and display metrics in a table
html_code <- '<table border="1">
<tr>
<th>Video</th>
<th>Number of Views</th>
<th>Likes</th>
</tr>
<tr>
<td>
<video width="320" height="240" controls>
<source src="%s" type="video/mp4">
</video>
</td>
<td>%d</td>
<td>%d</td>
</tr>
<tr>
<td>
<video width="320" height="240" controls>
<source src="%s" type="video/mp4">
</video>
</td>
<td>%d</td>
<td>%d</td>
</tr>
</table>'
# Replace placeholders in the HTML code with video information
html_code <- sprintf(
html_code,
videos$Link[1], videos$Views[1], videos$Likes[1],
videos$Link[2], videos$Views[2], videos$Likes[2]
)
# Convert HTML code to an HTML object
html_object <- HTML(html_code)
# Display the HTML object as a table
html_object