R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

data <- read.csv('socialmedia.csv') #read data
head(data)  #view the first 6 lines
##   User.ID         Username  Platform Post.ID
## 1     101 @adventureSeeker Instagram   82036
## 2     215  @foodieTraveler   Twitter   12463
## 3     303 @wellnessJourney  Facebook   45982
## 4     404    @fitnessFreak Instagram   16572
## 5     521    @foodExplorer   Twitter   75589
## 6     609  @wanderlustSoul  Facebook   24680
##                                                 Post.Text   Post.Timestamp
## 1 "Experiencing the thrill of a lifetime! #AdventureTime" 30-07-2023 14:45
## 2         "Indulging in local delicacies! #FoodieTravels" 30-07-2023 19:30
## 3                   "Finding peace and balance in nature! 30-07-2023 08:15
## 4                          "Pushing my limits in the gym! 30-07-2023 12:30
## 5           "Discovering unique flavors around the world! 30-07-2023 16:20
## 6                        "Embracing the beauty of nature! 30-07-2023 09:45
##   Likes.Reactions Comments Shares.Retweets         Hashtags Mentions Media.Type
## 1            1500      250             120   #AdventureTime     None      Image
## 2             850       70              50   #FoodieTravels     None       Text
## 3             680       80              40 #WellnessJourney     None      Image
## 4            1850      350             180    #FitnessGoals     None      Image
## 5             950       80              60         #Foodies     None       Text
## 6            1200      110              50      #Wanderlust     None      Image
##                           Media.URL                                   Post.URL
## 1  http://example.com/adventure.jpg http://instagram.com/adventureSeeker/82036
## 2                              None    http://twitter.com/foodieTraveler/12463
## 3   http://example.com/wellness.jpg  http://facebook.com/wellnessJourney/45982
## 4    http://example.com/fitness.jpg    http://instagram.com/fitnessFreak/16572
## 5                              None      http://twitter.com/foodExplorer/75589
## 6 http://example.com/wanderlust.jpg   http://facebook.com/wanderlustSoul/24680
##                 Location Privacy.Settings User.Followers User.Following
## 1 Yosemite National Park           Public          15000            500
## 2      Bangkok, Thailand           Public           8000            300
## 3        Bali, Indonesia           Public           6000            200
## 4       Los Angeles, USA           Public          32000            400
## 5          Paris, France           Public           7200           1800
## 6        Bali, Indonesia     Friends Only           9500            650
##   Account.Creation.Date Account.Verification User.Engagement User.Interactions
## 1            10-05-2019             Verified            1870             15700
## 2            15-09-2017         Not verified             970              8300
## 3            02-03-2020         Not verified             800              6200
## 4            12-08-2016             Verified            2380             32750
## 5            28-02-2018         Not verified            1090              9080
## 6            05-09-2019         Not verified            1360             10850
##      User.Activity             User.Bio      User.Description.1
## 1 3 posts per week Adventure enthusiast            Nature lover
## 2 5 posts per week    Culinary explorer Street food connoisseur
## 3 2 posts per week  Wellness enthusiast        Yogi in training
## 4 4 posts per week   Fitness enthusiast        Health is wealth
## 5 3 posts per week  Culinary adventurer    Gastronomic traveler
## 6 2 posts per week Traveler at heart ??            Nature lover
##        User.Description.2        Server.Post User.Language
## 1 Seeker of wanderlust ??    California, USA       English
## 2        Travel addict ??         London, UK       English
## 3    Mindfulness advocate San Francisco, USA       English
## 4          Workout addict   Los Angeles, USA       English
## 5             Bon app?it!      Paris, France       English
## 6             Free spirit    Bali, Indonesia       English
#perform some basic descriptive analysis 
summary(data)
##     User.ID           Username       Platform     Post.ID          Post.Text 
##  Min.   :101.0   Length   :39   Length   :39   Min.   :12462   Length   :39  
##  1st Qu.:215.0   N.unique :36   N.unique : 7   1st Qu.:27616   N.unique :39  
##  Median :427.0   N.blank  : 0   N.blank  : 0   Median :59243   N.blank  : 0  
##  Mean   :480.5   Min.nchar: 8   Min.nchar: 6   Mean   :54981   Min.nchar:23  
##  3rd Qu.:712.0   Max.nchar:17   Max.nchar: 9   3rd Qu.:81140   Max.nchar:55  
##  Max.   :943.0                                 Max.   :98342                 
##    Post.Timestamp Likes.Reactions     Comments     Shares.Retweets 
##  Length   :39     Min.   : 370.0   Min.   : 40.0   Min.   : 30.00  
##  N.unique :39     1st Qu.: 700.0   1st Qu.: 80.0   1st Qu.: 50.00  
##  N.blank  : 0     Median : 890.0   Median :110.0   Median : 60.00  
##  Min.nchar:16     Mean   : 967.2   Mean   :133.3   Mean   : 76.92  
##  Max.nchar:16     3rd Qu.:1135.0   3rd Qu.:165.0   3rd Qu.: 90.00  
##                   Max.   :2200.0   Max.   :350.0   Max.   :220.00  
##       Hashtags       Mentions      Media.Type     Media.URL       Post.URL 
##  Length   :39   Length   :39   Length   :39   Length   :39   Length   :39  
##  N.unique :38   N.unique : 1   N.unique : 3   N.unique :26   N.unique :39  
##  N.blank  : 0   N.blank  : 0   N.blank  : 0   N.blank  : 0   N.blank  : 0  
##  Min.nchar: 8   Min.nchar: 4   Min.nchar: 4   Min.nchar: 4   Min.nchar:29  
##  Max.nchar:18   Max.nchar: 4   Max.nchar: 5   Max.nchar:36   Max.nchar:43  
##                                                                            
##       Location   Privacy.Settings User.Followers  User.Following  
##  Length   :39   Length   :39      Min.   : 3200   Min.   : 200.0  
##  N.unique :16   N.unique : 2      1st Qu.: 6450   1st Qu.: 300.0  
##  N.blank  : 0   N.blank  : 0      Median : 8200   Median : 400.0  
##  Min.nchar:10   Min.nchar: 6      Mean   :10459   Mean   : 489.7  
##  Max.nchar:22   Max.nchar:12      3rd Qu.:12750   3rd Qu.: 600.0  
##                                   Max.   :32000   Max.   :1800.0  
##  Account.Creation.Date Account.Verification User.Engagement User.Interactions
##  Length   :39          Length   :39         Min.   : 450    Min.   : 4600    
##  N.unique :38          N.unique : 2         1st Qu.: 840    1st Qu.: 7055    
##  N.blank  : 0          N.blank  : 0         Median :1050    Median : 9080    
##  Min.nchar:10          Min.nchar: 8         Mean   :1177    Mean   :11302    
##  Max.nchar:10          Max.nchar:12         3rd Qu.:1360    3rd Qu.:13550    
##                                             Max.   :2720    Max.   :32750    
##    User.Activity      User.Bio  User.Description.1 User.Description.2
##  Length   :39    Length   :39   Length   :39       Length   :39      
##  N.unique : 6    N.unique :33   N.unique :38       N.unique :37      
##  N.blank  : 0    N.blank  : 0   N.blank  : 0       N.blank  : 0      
##  Min.nchar:14    Min.nchar: 8   Min.nchar: 9       Min.nchar: 8      
##  Max.nchar:16    Max.nchar:20   Max.nchar:23       Max.nchar:24      
##                                                                      
##     Server.Post   User.Language
##  Length   :39   Length   :39   
##  N.unique :15   N.unique : 1   
##  N.blank  : 0   N.blank  : 0   
##  Min.nchar:10   Min.nchar: 7   
##  Max.nchar:19   Max.nchar: 7   
## 
#Let's perform a histogram analysis
par(mfrow=c(1,1))

hist(data$Comments,main='histogram plot for comments',xlab='comments',prob=T)
lines(density(data$Comments),lty='dashed',lwd=2.5, col='blue')

#Check if there are outliers using a boxplot
#Let's perform boxplots in two different ways
boxplot(data$Comments,main="Boxplot for comments", ylab="comments")

boxplot(data$Comments,main="Boxplot for comments", horizontal = TRUE, xlab="comments")