# Load data
data <- read_csv("inputs/JP_youtube_trending_data.csv")
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
## dat <- vroom(...)
## problems(dat)
## Rows: 206180 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): video_id, title, channelId, channelTitle, tags, thumbnail_link, de...
## dbl (5): categoryId, view_count, likes, dislikes, comment_count
## lgl (2): comments_disabled, ratings_disabled
## dttm (2): publishedAt, trending_date
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
categories <- fromJSON(file = "inputs/JP_category_id.json")
# Preprocess data
categories_df <- map_dfr(categories$items, ~{
tibble(
categoryId = as.integer(.x$id),
categoryTitle = .x$snippet$title
)
})
data <- left_join(data, categories_df, by = "categoryId")
This section provides a snapshot of the data we are working with.
kable(head(data)) %>%
kable_styling(full_width = F) %>%
column_spec(1:ncol(data), width = "3em")
| video_id | title | publishedAt | channelId | channelTitle | categoryId | trending_date | tags | view_count | likes | dislikes | comment_count | thumbnail_link | comments_disabled | ratings_disabled | description | categoryTitle |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| UYXa8R9vvzA | 皆からの色々な質問に何も隠さず答える!びっくりさせたらごめん笑 | 2020-08-11 10:00:06 | UCZCzstgLGQdK8GSztJHh0-w | タナカガ | 22 | 2020-08-12 | [None] | 778499 | 34811 | 667 | 3939 | https://i.ytimg.com/vi/UYXa8R9vvzA/default.jpg | FALSE | FALSE | 登録者数30万人ありがとうございます!!!ご機嫌ようみなさま。お久しぶりでございます。なんか色々突然過ぎてごめんなさい笑質問の動画は前から撮ろうと思っててんけど、いざ質問募集してみると「彼氏本当にいないんですか?」とか「さすがに彼氏出来ましたよね!?」みたいな質問で溢れかえっててビックリした所存でございます笑でも聞かれたからには答えないとという事で突然ですが答えさせていただきました。ビックリさせちゃってごめんなさい。でも本当に心から尊敬できて、めちゃくちゃ優しくて(ブブにも)私には勿体無いぐらい素敵な人なので暖かく見守って頂ければなと思います!!彼氏出来て思った事は、彼氏おる人って毎日こんな幸せな生活送ってるん?私ほんまに21年間何してたん?以上です。タナカガ【Twitter】https://twitter.com/Tanakaga_【Instagram】https://www.instagram.com/tanakaga.12【TikTok】https://vt.tiktok.com/dwQH3E/ パパラピーズ【YouTube】https://www.youtube.com/channel/UCwN4CR-bDM9ZjvPhb44AfxQ | People & Blogs |
| 02MaoZ5n-uM | 【異次元】世界に伝えたい『This is ギータ』【変態打ち】 | 2020-08-11 13:36:28 | UC0v-pxTo1XamIDE-f__Ad0Q | (パーソル パ・リーグTV公式)PacificLeagueTV | 17 | 2020-08-12 | パーソルパリーグTV|パリーグTV|パシフィックリーグ|Pacificleague|プロ野球 | 1161952 | 18514 | 259 | 4115 | https://i.ytimg.com/vi/02MaoZ5n-uM/default.jpg | FALSE | FALSE | 言葉が出ない。スゴすぎて、異次元過ぎて、言葉が出ない。左対左、だけど何となく打ちそうな気はしていた。でも実際にその通りになると、言葉が出ない。スゴすぎて。世界に伝えたい、福岡ソフトバンク・柳田悠岐の『This is ギータ』。<パ・リーグ主催全試合を生中継!パーソル パ・リーグTVはこちら!>https://tv.pacificleague.jp/✓パ・リーグ6球団公式情報をお届け:https://insight.official-pacificleague.com/✓パーソル パ・リーグTVチャンネル登録:www.youtube.com/c/PacificLeagueTVofficial/✓パ・リーグの過去映像を見るなら:http://bit.ly/3aFW2X5✓動画をもっと見るなら:www.youtube.com/c/PacificLeagueTVofficial/SNSも毎日更新中!▶Twitter:https://twitter.com/PacificleagueTV▶Instagram:https://www.instagram.com/pacificleaguetv/▶Facebook:https://www.facebook.com/pacificleaguetv▶LINE:https://lin.ee/2hB4obT#福岡ソフトバンクホークス #柳田悠岐 #SoftBankHawks #福岡軟銀 #パーソルパリーグTV #パシフィックリーグ #新しい特等席 | Sports |
| ucDDYszgj5c | 【親心】てつやを一番よく知るのは誰?第1回てつやの母親に聞くてつや王! | 2020-08-11 12:00:11 | UCutJqz56653xV2wwSvut_hQ | 東海オンエア | 23 | 2020-08-12 | [None] | 1980557 | 63961 | 692 | 6216 | https://i.ytimg.com/vi/ucDDYszgj5c/default.jpg | FALSE | FALSE | それにしても実家に帰ってません。あまりにいつでも帰れるので逆にタイミングが難しくなってます。てつやの実家の方が行ってるくらいです。しかし帰って来いとは言われません。僕が元気なのは毎日更新されるYouTubeやSNSを通して充分伝わってるからかもしれません。帰って来いどころか僕がある程度大きくなってからは、僕のすることに口出しもしません。家業があるのに自由にさせてくれます。信じて僕に賭けてます。現状建設業を学んでいてほしかっただろう長男は、YouTuberとカフェオーナーをしています。誤算ではあるでしょう。勝手にさせてもらってるからには、「息子どう育つかなギャンブル」を必ず勝たせなければなりません。何も蔑ろにするつもりはありません。お盆は久しぶりに帰ろうと思います。(編集 : りょう)どうも、東海オンエアです。ぜひチャンネル登録お願いします!サブチャンネル【東海オンエアの控え室】もぜひチャンネル登録してね!!!https://www.youtube.com/channel/UCynIYcsBwTrwBIecconPN2Aグッズ購入はこちらから!!https://goo.gl/YtauZW有料メンバーシップの登録はこちらから!https://www.youtube.com/channel/UCutJqz56653xV2wwSvut_hQ/joinお仕事の依頼はこちらからhttps://www.uuum.co.jp/inquiry_promotionファンレターはこちらへ〒107-6228東京都港区赤坂9-7-1ミッドタウン・タワー 28階UUUM株式会社 東海オンエア宛【Twitterアカウント】てつや→https://twitter.com/TO_TETSUYAとしみつ→https://twitter.com/TO_TOSHIMITSUしばゆー→https://twitter.com/TOKAI_ONAIRりょう→https://twitter.com/TO_RYOOゆめまる→https://twitter.com/TO_yumemarucas虫眼鏡→https://twitter.com/TO_ZAWAKUN | Comedy |
| M9Pmf9AB4Mo | Apex Legends | Stories from the Outlands – “The Endorsement” | 2020-08-11 17:00:10 | UC0ZV6M2THA81QT9hrVWJG3A | Apex Legends | 20 | 2020-08-12 | Apex Legends|Apex Legends characters|new Apex Legend|Apex Legends Rampart|Apex Legends Season 6|Apex Legends Boosted|Battle Pass|Season 6 Battle Pass|Apex Legends new season|Apex Legends game|Respawn Apex Legends|Battle Royale game|Battle Royale|Battle Royale shooter|Apex Games|squad play|multiplayer shooter|Apex Legends PS4|Apex Legends Xbox|Apex Legends PC|Apex Legends Origin|Respawn Entertainment|Electronic Arts|Titanfall 2|fun battle royale | 2381688 | 146742 | 2794 | 16557 | https://i.ytimg.com/vi/M9Pmf9AB4Mo/default.jpg | FALSE | FALSE | While running her own modding shop, Ramya Parekh (aka Rampart) built her rep in underground gauntlet circuits. But success has a way of making enemies. Good thing she knows how to use all those fancy weapons she’s upgraded… Apex Legends™ is a free-to-play battle royale game where legendary characters battle for glory, fame, and fortune on the fringes of the Frontier. Play for free now on Xbox One, PS4, and Origin for PC. Learn more about Apex Legends Season 6 – Boosted: http://x.ea.com/64060 Check out our YouTube channel: http://x.ea.com/56710.Follow us on Twitter: https://twitter.com/playapex.Follow us on Instagram: https://www.instagram.com/playapex/.#MeetRampart #ApexSeason6 #ApexSeasonSix #ApexLegends | Gaming |
| tkaU_Ctzhes | 映画『銀魂 THE FINAL』特報 2021年1月8日(金)公開 | 2020-08-11 23:00:00 | UCSrwpEM8lBM4jR5YoKX3XOQ | ワーナー ブラザース 公式チャンネル | 1 | 2020-08-12 | 銀魂|gintama|劇場版|空知英秋|杉田智和|釘宮理恵|阪口大助|アニメ|anime|週刊少年ジャンプ|Weekly JUMP|映画|公式|WB|ワーナー|ワーナー・ブラザース|劇場|アクション|コメディ|漫画|集英社|坂田銀時|志村新八|神楽|真選組|銀さん|小栗旬|菅田将暉|橋本環奈|天気の子|名探偵コナン|鬼滅の刃|るろうに剣心|キングダム|翔んで埼玉|佐藤二朗|ムロツヨシ|特報|予告|trailer | 442524 | 14388 | 73 | 1420 | https://i.ytimg.com/vi/tkaU_Ctzhes/default.jpg | FALSE | FALSE | 「銀魂」本当のラスト!最後のバカ騒ぎが、始まる!笑いも涙も宇宙規模で限界突破!『銀魂 THE FINAL』新年1月8日(金)に公開決定!2021年のお正月は「銀魂」で決まりだァァァァ!!■『銀魂 THE FINAL』2021年1月8日(金)公開公式サイト:gintamamovie.jp 公式Twitter:@gintamamovie #銀魂ザファイナル©空知英秋/劇場版銀魂製作委員会 配給:ワーナー・ブラザース映画 | Film & Animation |
| dQ40Mi1eYTA | 元ヤクルト宮本慎也とキャッチボール。暴投しない人はこう投げる。 | 2020-08-11 09:30:02 | UCfkM3u-0uSKADDitZLpXcfA | トクサンTV【A&R】 | 26 | 2020-08-12 | プロ野球|ニュース|配球|監督|コツ|ライパチ|トクサン|アニキ|天晴|トクサンTV|クニヨシTV | 431031 | 6096 | 123 | 607 | https://i.ytimg.com/vi/dQ40Mi1eYTA/default.jpg | FALSE | FALSE | トクサンTV的未来モンスター企画!この日は関東の強豪東練馬リトルシニアにきましたが、、、そこに元NPBレジェンドがいたのでキャチボールした【東練馬リトルシニア情報】https://www.higashinerima.com/チームベースボールTシャツhttps://store.shopping.yahoo.co.jp/k-conmart/t-17.htmlhttps://store.shopping.yahoo.co.jp/k-conmart/t-18.html【全国の野球ショップさんへ…賛同していただける方はぜひご連絡を!】tokusanTV@gmail.com独立リーグのリアル配信中!「ワイラプTV」…登録してちょ!https://www.youtube.com/channel/UCEDJgq9yLYrooQMZkXXwWfAクニヨシTV【with サルトラ】(兄弟チャンネル)https://www.youtube.com/channel/UCN7zL9IXNqxZDMIjlih1_Mw★天晴の成績・試合予定は「PLAY PORTAL」で見れます★https://tmhub.jp/teams/3365/home★毎日18:30に動画をアップします!!★ We upload a new baseball video EVERY DAY so please SUBSCRIBE ★チャンネル登録はこちら↓https://www.youtube.com/channel/UCfkM3u-0uSKADDitZLpXcfAーーーーーーーーーー ★<トクサン>ツイッター↓ @tokusanTV ★<アニキ>ツイッター↓@Aniki_kusayakyu★<ライパチ>ツイッター↓@no8rightboy是非 フォローお願いいたしますm(_ _)m★トクサンTVとコラボレーションのお問い合わせはtokusanTV@gmail.com(※可能な限り御返信させて頂きます) | Howto & Style |
In this section, we will explore the number of trending videos by category, and visualize the correlation matrix of the numerical features in the dataset.
df <- data %>%
group_by(categoryTitle) %>%
summarise(n = n(), .groups = 'drop') %>%
arrange(desc(n))
ggplot(df, aes(x = reorder(categoryTitle, -n), y = n)) +
geom_bar(stat = "identity") +
coord_flip() +
labs(x = "Category Title", y = "Count", title = "Number of Trending Videos by Category")
numerical_features <- data %>%
select(likes, dislikes, view_count, comment_count)
corr_mat <- cor(numerical_features, use = "pairwise.complete.obs")
corrplot::corrplot(corr_mat, method = "circle")
Now let’s take a look at the posting times of trending videos.
data_time <- data %>%
mutate(hour = hour(ymd_hms(publishedAt, truncated = 3))) %>%
group_by(hour) %>%
summarise(n = n(), .groups = 'drop')
ggplot(data_time, aes(x = hour, y = n)) +
geom_line() +
labs(x = "Hour", y = "Count", title = "Posting Times of Trending Videos")
Based on the produced plots, here are some conclusions we can make about the trends in the YouTube JP Trends dataset:
Category plot: The category plot shows the number of trending videos by category. The ‘Entertainment’ category has the highest number of trending videos, followed by ‘Gaming’ and ‘Music.’ This suggests that entertainment-based content is highly popular among viewers. Conversely, the ‘Education’ and ‘Science & Technology’ categories have relatively fewer trending videos. This indicates a potential opportunity for content creators to explore these categories and take the chance to make a blast on a less saturated market.
Correlation Matrix: The correlation matrix depicts the relationships between different variables. By analyzing the correlation coefficients, we can gain insights into the interdependencies among the variables. It appears that there is a strong positive correlation between the number of views and the number of likes. This implies that videos with more views tend to receive a higher number of likes, indicating a positive reception from viewers.
Posting Time of Trending Videos: The posting time chart displays the distribution of trending video postings over time. From the chart, it can be observed that there are spikes in video postings during certain time periods, especially around 10 am. This indicates that content creators may strategically choose these times to publish their videos to maximize visibility and potential engagement from viewers.
These insights provide a starting point for further investigation and strategic decision-making. Content creators can consider focusing on popular categories such as entertainment and music while exploring untapped areas like education. Additionally, they can leverage the positive correlation between views and likes to optimize their content strategies. Finally, analyzing the posting time distribution can guide creators in scheduling their video releases for maximum impact.