library(ggplot2) library(dplyr) library(plotly) library(tidyverse)
2024-06-05
library(ggplot2) library(dplyr) library(plotly) library(tidyverse)
df = read.csv("Top Youtubers Dataset.csv")
head(df)
## Rank Youtuber Subscribers Video.Views Video.Count ## 1 1 MrBeast 284000000 5.24029e+10 803 ## 2 2 T-Series 268000000 2.58624e+11 21237 ## 3 3 YouTube Movies 181000000 0.00000e+00 0 ## 4 4 Cocomelon - Nursery Rhymes 177000000 1.82881e+11 1188 ## 5 5 SET India 174000000 1.65395e+11 139720 ## 6 6 ? Kids Diana Show 123000000 1.03973e+11 1230 ## Category Started ## 1 Entertainment 2012 ## 2 Music 2006 ## 3 Film & Animation 2015 ## 4 Education 2006 ## 5 Shows 2006 ## 6 People & Blogs 2015
print("A simple linear regression measures the correlation between two variables.
This is usually done by means of a scatter plot, where one can usually see the correlation.
However, a regression line can be coded into the graph to provide more specific and
concrete evidence as to the sign of the correlation and its intensity.")
ggplot(df, aes(x = Subscribers, y = Video.Views)) +
geom_point() +
stat_smooth(method = "lm", formula = y~x, geom = "smooth") +
labs(title = "Subscribers vs. Video_Views")
unique_cat = unique(df$Category) print(unique_cat)
## [1] "Entertainment" "Music" "Film & Animation" ## [4] "Education" "Shows" "People & Blogs" ## [7] "" "Gaming" "Sports" ## [10] "Howto & Style" "News & Politics" "Science & Technology" ## [13] "Comedy" "Trailers" "Nonprofits & Activism" ## [16] "Movies" "Pets & Animals" "Autos & Vehicles"