About Dataset

The IMDB dataset contains information about movieData, including their names, release dates, user ratings, genres, overviews, cast and crew members, original titles, production status, original languages, budgets, revenues, and countries of origin. This data can be used for various analyses, such as identifying trends in movie genres, exploring the relationship between budget and revenue, and predicting the success of future movieData.

# Load the lubridate package
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
library(plyr)
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following objects are masked from 'package:plyr':
## 
##     arrange, mutate, rename, summarise
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readr)
library(vcd)
## Loading required package: grid
movieData <-read.csv('C:/Users/govin/OneDrive/Desktop/RStudio/Data/imdb_movieData.csv')

movieData$date_x <- sapply(movieData$date_x, function(x) gsub("/", "-", x))
movieData[c('date_x')] <- lapply(movieData[c('date_x')], function(x) as.Date(x, format="%m-%d-%Y"))
movieData <- type_convert(movieData)
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   names = col_character(),
##   genre = col_character(),
##   overview = col_character(),
##   crew = col_character(),
##   orig_title = col_character(),
##   status = col_character(),
##   orig_lang = col_character(),
##   country = col_character()
## )
head(movieData, 10)
##                           names     date_x score
## 1                     Creed III 2023-03-02    73
## 2      Avatar: The Way of Water 2022-12-15    78
## 3   The Super Mario Bros. Movie 2023-04-05    76
## 4                       Mummies 2023-01-05    70
## 5                     Supercell 2023-03-17    61
## 6                  Cocaine Bear 2023-02-23    66
## 7          John Wick: Chapter 4 2023-03-23    80
## 8  Puss in Boots: The Last Wish 2022-12-26    83
## 9               Attack on Titan 2022-09-30    59
## 10                     The Park 2023-03-02    58
##                                               genre
## 1                                     Drama, Action
## 2                Science Fiction, Adventure, Action
## 3     Animation, Adventure, Family, Fantasy, Comedy
## 4     Animation, Comedy, Family, Adventure, Fantasy
## 5                                            Action
## 6                           Thriller, Comedy, Crime
## 7                           Action, Thriller, Crime
## 8     Animation, Family, Fantasy, Adventure, Comedy
## 9                           Action, Science Fiction
## 10 Action, Drama, Horror, Science Fiction, Thriller
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                      overview
## 1  After dominating the boxing world, Adonis Creed has been thriving in both his career and family life. When a childhood friend and former boxing prodigy, Damien Anderson, resurfaces after serving a long sentence in prison, he is eager to prove that he deserves his shot in the ring. The face-off between former friends is more than just a fight. To settle the score, Adonis must put his future on the line to battle Damien — a fighter who has nothing to lose.
## 2                                                                                                                                                                                            Set more than a decade after the events of the first film, learn the story of the Sully family (Jake, Neytiri, and their kids), the trouble that follows them, the lengths they go to keep each other safe, the battles they fight to stay alive, and the tragedies they endure.
## 3                                                                                                                                                                                                                While working underground to fix a water main, Brooklyn plumbers—and brothers—Mario and Luigi are transported down a mysterious pipe and wander into a magical new world. But when the brothers are separated, Mario embarks on an epic quest to find Luigi.
## 4                                                                                                                                                                                                                                      Through a series of unfortunate events, three mummies end up in present-day London and embark on a wacky and hilarious journey in search of an old ring belonging to the Royal Family, stolen by ambitious archaeologist Lord Carnaby.
## 5                                                         Good-hearted teenager William always lived in hope of following in his late father’s footsteps and becoming a storm chaser. His father’s legacy has now been turned into a storm-chasing tourist business, managed by the greedy and reckless Zane Rogers, who is now using William as the main attraction to lead a group of unsuspecting adventurers deep into the eye of the most dangerous supercell ever seen.
## 6                                                                                                                                                                                                                                                            Inspired by a true story, an oddball group of cops, criminals, tourists and teens converge in a Georgia forest where a 500-pound black bear goes on a murderous rampage after unintentionally ingesting cocaine.
## 7                                                                                                                                                                                                          With the price on his head ever increasing, John Wick uncovers a path to defeating The High Table. But before he can earn his freedom, Wick must face off against a new enemy with powerful alliances across the globe and forces that turn old friends into foes.
## 8                                                                                                                                                                                                                  Puss in Boots discovers that his passion for adventure has taken its toll: He has burned through eight of his nine lives, leaving him with only one life left. Puss sets out on an epic journey to find the mythical Last Wish and restore his nine lives.
## 9                                                                                                                                                                           As viable water is depleted on Earth, a mission is sent to Saturn's moon Titan to retrieve sustainable H2O reserves from its alien inhabitants. But just as the humans acquire the precious resource, they are attacked by Titan rebels, who don't trust that the Earthlings will leave in peace.
## 10                                                                                                                                                                                                                    A dystopian coming-of-age movie focused on three kids who find themselves in an abandoned amusement park, aiming to unite whoever remains. With dangers lurking around every corner, they will do whatever it takes to survive their hellish Neverland.
##                                                                                                                                                                                                                                                                                                                  crew
## 1              Michael B. Jordan, Adonis Creed, Tessa Thompson, Bianca Taylor, Jonathan Majors, Damien Anderson, Wood Harris, Tony 'Little Duke' Evers, Phylicia Rashād, Mary Anne Creed, Mila Davis-Kent, Amara Creed, Florian Munteanu, Viktor Drago, José Benavidez Jr., Felix Chavez, Selenis Leyva, Laura Chavez
## 2                                        Sam Worthington, Jake Sully, Zoe Saldaña, Neytiri, Sigourney Weaver, Kiri / Dr. Grace Augustine, Stephen Lang, Colonel Miles Quaritch, Kate Winslet, Ronal, Cliff Curtis, Tonowari, Joel David Moore, Norm Spellman, CCH Pounder, Mo'at, Edie Falco, General Frances Ardmore
## 3     Chris Pratt, Mario (voice), Anya Taylor-Joy, Princess Peach (voice), Charlie Day, Luigi (voice), Jack Black, Bowser (voice), Keegan-Michael Key, Toad (voice), Seth Rogen, Donkey Kong (voice), Fred Armisen, Cranky Kong (voice), Kevin Michael Richardson, Kamek (voice), Sebastian Maniscalco, Spike (voice)
## 4        Óscar Barberán, Thut (voice), Ana Esther Alborg, Nefer (voice), Luis Pérez Reina, Carnaby (voice), María Luisa Solá, Madre (voice), Jaume Solà, Sekhem (voice), José Luis Mediavilla, Ed (voice), José Javier Serrano Rodríguez, Danny (voice), Aleix Estadella, Dennis (voice), María Moscardó, Usi (voice)
## 5                                                                    Skeet Ulrich, Roy Cameron, Anne Heche, Dr Quinn Brody, Daniel Diemer, William Brody, Jordan Kristine Seamón, Harper Hunter, Alec Baldwin, Zane Rogers, Richard Gunn, Bill Brody, Praya Lundberg, Amy, Johnny Wactor, Martin, Anjul Nigam, Ramesh
## 6                                                                          Keri Russell, Sari, Alden Ehrenreich, Eddie, O'Shea Jackson Jr., Daveed, Ray Liotta, Syd, Kristofer Hivju, Olaf (Kristoffer), Margo Martindale, Ranger Liz, Christian Convery, Henry, Isiah Whitlock Jr., Bob, Jesse Tyler Ferguson, Peter
## 7                                                                    Keanu Reeves, John Wick, Donnie Yen, Caine, Bill Skarsgård, Marquis de Gramont, Ian McShane, Winston, Laurence Fishburne, Bowery King, Lance Reddick, Charon, Clancy Brown, The Harbinger, Hiroyuki Sanada, Shimazu, Shamier Anderson, Mr Nobody
## 8  Antonio Banderas, Puss in Boots (voice), Salma Hayek, Kitty Softpaws (voice), Harvey Guillén, Perrito (voice), Wagner Moura, Wolf (voice), Florence Pugh, Goldilocks (voice), Olivia Colman, Mama Bear (voice), Ray Winstone, Papa Bear (voice), Samson Kayo, Baby Bear (voice), John Mulaney, Jack Horner (voice)
## 9                                                                Paul Bianchi, Computer (voice), Erin Coker, Allison Quince, Jack Pearson, Max Reece, Anthony Jensen, Jowers, Neli Sabour, Heidi Quince, Karan Sagoo, Adrian Naidu, Natalie Storrs, Saoirse Parker, Justin Tanks, Mark Morales, Jenny Tran, Kim Costa
## 10                                                                                     Chloe Guidry, Ines, Nhedrick Jabier, Bui, Carmina Garay, Kuan, Billy Slaughter, Martin Parker, Carli McIntyre, Rue, Laura Coover, Reporter, Presley Richardson, Bennett, Sean Papajohn, Jack, Legend Jay Jones, Slingshot Gang
##                      orig_title   status          orig_lang  budget_x
## 1                     Creed III Released            English  75000000
## 2      Avatar: The Way of Water Released            English 460000000
## 3   The Super Mario Bros. Movie Released            English 100000000
## 4                        Momias Released Spanish, Castilian  12300000
## 5                     Supercell Released            English  77000000
## 6                  Cocaine Bear Released            English  35000000
## 7          John Wick: Chapter 4 Released            English 100000000
## 8  Puss in Boots: The Last Wish Released            English  90000000
## 9               Attack on Titan Released            English  71000000
## 10                     The Park Released            English 119200000
##       revenue country
## 1   271616668      AU
## 2  2316794914      AU
## 3   724459031      AU
## 4    34200000      AU
## 5   340941959      US
## 6    80000000      AU
## 7   351349364      AU
## 8   483480577      AU
## 9   254946484      US
## 10  488962491      US
movieData["score"] <- movieData["revenue"] - movieData["revenue"]
head(movieData, 10)
##                           names     date_x score
## 1                     Creed III 2023-03-02     0
## 2      Avatar: The Way of Water 2022-12-15     0
## 3   The Super Mario Bros. Movie 2023-04-05     0
## 4                       Mummies 2023-01-05     0
## 5                     Supercell 2023-03-17     0
## 6                  Cocaine Bear 2023-02-23     0
## 7          John Wick: Chapter 4 2023-03-23     0
## 8  Puss in Boots: The Last Wish 2022-12-26     0
## 9               Attack on Titan 2022-09-30     0
## 10                     The Park 2023-03-02     0
##                                               genre
## 1                                     Drama, Action
## 2                Science Fiction, Adventure, Action
## 3     Animation, Adventure, Family, Fantasy, Comedy
## 4     Animation, Comedy, Family, Adventure, Fantasy
## 5                                            Action
## 6                           Thriller, Comedy, Crime
## 7                           Action, Thriller, Crime
## 8     Animation, Family, Fantasy, Adventure, Comedy
## 9                           Action, Science Fiction
## 10 Action, Drama, Horror, Science Fiction, Thriller
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                      overview
## 1  After dominating the boxing world, Adonis Creed has been thriving in both his career and family life. When a childhood friend and former boxing prodigy, Damien Anderson, resurfaces after serving a long sentence in prison, he is eager to prove that he deserves his shot in the ring. The face-off between former friends is more than just a fight. To settle the score, Adonis must put his future on the line to battle Damien — a fighter who has nothing to lose.
## 2                                                                                                                                                                                            Set more than a decade after the events of the first film, learn the story of the Sully family (Jake, Neytiri, and their kids), the trouble that follows them, the lengths they go to keep each other safe, the battles they fight to stay alive, and the tragedies they endure.
## 3                                                                                                                                                                                                                While working underground to fix a water main, Brooklyn plumbers—and brothers—Mario and Luigi are transported down a mysterious pipe and wander into a magical new world. But when the brothers are separated, Mario embarks on an epic quest to find Luigi.
## 4                                                                                                                                                                                                                                      Through a series of unfortunate events, three mummies end up in present-day London and embark on a wacky and hilarious journey in search of an old ring belonging to the Royal Family, stolen by ambitious archaeologist Lord Carnaby.
## 5                                                         Good-hearted teenager William always lived in hope of following in his late father’s footsteps and becoming a storm chaser. His father’s legacy has now been turned into a storm-chasing tourist business, managed by the greedy and reckless Zane Rogers, who is now using William as the main attraction to lead a group of unsuspecting adventurers deep into the eye of the most dangerous supercell ever seen.
## 6                                                                                                                                                                                                                                                            Inspired by a true story, an oddball group of cops, criminals, tourists and teens converge in a Georgia forest where a 500-pound black bear goes on a murderous rampage after unintentionally ingesting cocaine.
## 7                                                                                                                                                                                                          With the price on his head ever increasing, John Wick uncovers a path to defeating The High Table. But before he can earn his freedom, Wick must face off against a new enemy with powerful alliances across the globe and forces that turn old friends into foes.
## 8                                                                                                                                                                                                                  Puss in Boots discovers that his passion for adventure has taken its toll: He has burned through eight of his nine lives, leaving him with only one life left. Puss sets out on an epic journey to find the mythical Last Wish and restore his nine lives.
## 9                                                                                                                                                                           As viable water is depleted on Earth, a mission is sent to Saturn's moon Titan to retrieve sustainable H2O reserves from its alien inhabitants. But just as the humans acquire the precious resource, they are attacked by Titan rebels, who don't trust that the Earthlings will leave in peace.
## 10                                                                                                                                                                                                                    A dystopian coming-of-age movie focused on three kids who find themselves in an abandoned amusement park, aiming to unite whoever remains. With dangers lurking around every corner, they will do whatever it takes to survive their hellish Neverland.
##                                                                                                                                                                                                                                                                                                                  crew
## 1              Michael B. Jordan, Adonis Creed, Tessa Thompson, Bianca Taylor, Jonathan Majors, Damien Anderson, Wood Harris, Tony 'Little Duke' Evers, Phylicia Rashād, Mary Anne Creed, Mila Davis-Kent, Amara Creed, Florian Munteanu, Viktor Drago, José Benavidez Jr., Felix Chavez, Selenis Leyva, Laura Chavez
## 2                                        Sam Worthington, Jake Sully, Zoe Saldaña, Neytiri, Sigourney Weaver, Kiri / Dr. Grace Augustine, Stephen Lang, Colonel Miles Quaritch, Kate Winslet, Ronal, Cliff Curtis, Tonowari, Joel David Moore, Norm Spellman, CCH Pounder, Mo'at, Edie Falco, General Frances Ardmore
## 3     Chris Pratt, Mario (voice), Anya Taylor-Joy, Princess Peach (voice), Charlie Day, Luigi (voice), Jack Black, Bowser (voice), Keegan-Michael Key, Toad (voice), Seth Rogen, Donkey Kong (voice), Fred Armisen, Cranky Kong (voice), Kevin Michael Richardson, Kamek (voice), Sebastian Maniscalco, Spike (voice)
## 4        Óscar Barberán, Thut (voice), Ana Esther Alborg, Nefer (voice), Luis Pérez Reina, Carnaby (voice), María Luisa Solá, Madre (voice), Jaume Solà, Sekhem (voice), José Luis Mediavilla, Ed (voice), José Javier Serrano Rodríguez, Danny (voice), Aleix Estadella, Dennis (voice), María Moscardó, Usi (voice)
## 5                                                                    Skeet Ulrich, Roy Cameron, Anne Heche, Dr Quinn Brody, Daniel Diemer, William Brody, Jordan Kristine Seamón, Harper Hunter, Alec Baldwin, Zane Rogers, Richard Gunn, Bill Brody, Praya Lundberg, Amy, Johnny Wactor, Martin, Anjul Nigam, Ramesh
## 6                                                                          Keri Russell, Sari, Alden Ehrenreich, Eddie, O'Shea Jackson Jr., Daveed, Ray Liotta, Syd, Kristofer Hivju, Olaf (Kristoffer), Margo Martindale, Ranger Liz, Christian Convery, Henry, Isiah Whitlock Jr., Bob, Jesse Tyler Ferguson, Peter
## 7                                                                    Keanu Reeves, John Wick, Donnie Yen, Caine, Bill Skarsgård, Marquis de Gramont, Ian McShane, Winston, Laurence Fishburne, Bowery King, Lance Reddick, Charon, Clancy Brown, The Harbinger, Hiroyuki Sanada, Shimazu, Shamier Anderson, Mr Nobody
## 8  Antonio Banderas, Puss in Boots (voice), Salma Hayek, Kitty Softpaws (voice), Harvey Guillén, Perrito (voice), Wagner Moura, Wolf (voice), Florence Pugh, Goldilocks (voice), Olivia Colman, Mama Bear (voice), Ray Winstone, Papa Bear (voice), Samson Kayo, Baby Bear (voice), John Mulaney, Jack Horner (voice)
## 9                                                                Paul Bianchi, Computer (voice), Erin Coker, Allison Quince, Jack Pearson, Max Reece, Anthony Jensen, Jowers, Neli Sabour, Heidi Quince, Karan Sagoo, Adrian Naidu, Natalie Storrs, Saoirse Parker, Justin Tanks, Mark Morales, Jenny Tran, Kim Costa
## 10                                                                                     Chloe Guidry, Ines, Nhedrick Jabier, Bui, Carmina Garay, Kuan, Billy Slaughter, Martin Parker, Carli McIntyre, Rue, Laura Coover, Reporter, Presley Richardson, Bennett, Sean Papajohn, Jack, Legend Jay Jones, Slingshot Gang
##                      orig_title   status          orig_lang  budget_x
## 1                     Creed III Released            English  75000000
## 2      Avatar: The Way of Water Released            English 460000000
## 3   The Super Mario Bros. Movie Released            English 100000000
## 4                        Momias Released Spanish, Castilian  12300000
## 5                     Supercell Released            English  77000000
## 6                  Cocaine Bear Released            English  35000000
## 7          John Wick: Chapter 4 Released            English 100000000
## 8  Puss in Boots: The Last Wish Released            English  90000000
## 9               Attack on Titan Released            English  71000000
## 10                     The Park Released            English 119200000
##       revenue country
## 1   271616668      AU
## 2  2316794914      AU
## 3   724459031      AU
## 4    34200000      AU
## 5   340941959      US
## 6    80000000      AU
## 7   351349364      AU
## 8   483480577      AU
## 9   254946484      US
## 10  488962491      US

Assumption: There are no ordered variables in this dataset apart from status. Lets assume ordering/ weights for these classes in the following order:

Same Day- 4 First Class - 3 Second Class- 2 Standard Class- 1

unique(movieData["status"])
##              status
## 1          Released
## 118 Post Production
## 802   In Production
set_1 <- c("budget_x", "revenue", "status", "score")
set_2 <- c("revenue", "revenue", "status", "score")
set_3 <- c("budget_x", "revenue", "status", "score")

movieData_1 <- movieData[set_1]
movieData_2 <- movieData[set_2]
movieData_3 <- movieData[set_3]

IMP: Setting response variable as “status” for all the 3 sample dataframes.

Set 1 Analysis

# Convert to factors if necessary
movieData_1$status <- as.factor(movieData_1$status)

# Create boxplots using a loop
for (variable in set_1) {
  if (variable != "status") {
    plot_data <- ggplot(movieData_1, aes(x = status, y = movieData_1[[variable]])) +
      geom_boxplot() +
      ggtitle(paste("Boxplot of", variable, "by status")) +
      xlab("status") +
      ylab(variable)
    
    print(plot_data)
  }
}
## Warning: Use of `movieData_1[[variable]]` is discouraged.
## ℹ Use `.data[[variable]]` instead.

## Warning: Use of `movieData_1[[variable]]` is discouraged.
## ℹ Use `.data[[variable]]` instead.

## Warning: Use of `movieData_1[[variable]]` is discouraged.
## ℹ Use `.data[[variable]]` instead.

> Above upper whisker, for all ship modes some outliers can be observed.

# Creating scatter plots for all pairs of continuous variables excluding "status"
for (i in 1:(length(set_1) - 1)) {
  for (j in (i + 1):length(set_1)) {
    if (is.numeric(movieData_1[[set_1[i]]]) && is.numeric(movieData_1[[set_1[j]]]) &&
        !identical(movieData_1[[set_1[i]]], movieData_1[[set_1[j]]])) {
      plot_data <- ggplot(movieData_1, aes_string(x = set_1[i], y = set_1[j])) +
        geom_point() +
        ggtitle(paste("Scatter plot of", set_1[i], "vs", set_1[j])) +
        xlab(set_1[i]) +
        ylab(set_1[j])
      
      print(plot_data)
    }
  }
}
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

> Nothing very different can be seen in the scatter plots, its mostly uniform for all the variables.

Correlation Matrix for set 1

# Calculating Pearson correlation for each pair of continuous variables in set_1
cor_matrix <- cor(movieData_1[, set_1[set_1!="status"]])
## Warning in cor(movieData_1[, set_1[set_1 != "status"]]): the standard deviation
## is zero
# Printing the correlation matrix
print(cor_matrix)
##           budget_x   revenue score
## budget_x 1.0000000 0.6738296    NA
## revenue  0.6738296 1.0000000    NA
## score           NA        NA     1

Strongest relationship here can be seen between budget and quantity which makes sense also. Although, I would not term this also a very strong relationship.

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0     ✔ tibble  3.2.1
## ✔ purrr   1.0.2     ✔ tidyr   1.3.0
## ✔ stringr 1.5.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::arrange()   masks plotly::arrange(), plyr::arrange()
## ✖ purrr::compact()   masks plyr::compact()
## ✖ dplyr::count()     masks plyr::count()
## ✖ dplyr::desc()      masks plyr::desc()
## ✖ dplyr::failwith()  masks plyr::failwith()
## ✖ dplyr::filter()    masks plotly::filter(), stats::filter()
## ✖ dplyr::id()        masks plyr::id()
## ✖ dplyr::lag()       masks stats::lag()
## ✖ dplyr::mutate()    masks plotly::mutate(), plyr::mutate()
## ✖ dplyr::rename()    masks plotly::rename(), plyr::rename()
## ✖ dplyr::summarise() masks plotly::summarise(), plyr::summarise()
## ✖ dplyr::summarize() masks plyr::summarize()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
library(ggpubr)
## 
## Attaching package: 'ggpubr'
## 
## The following object is masked from 'package:plyr':
## 
##     mutate
movieData <- movieData %>%
  mutate(profit = revenue - budget_x)

ggplot(data = movieData, mapping = aes(x = budget_x, y = revenue)) + 
  geom_point() +
  geom_smooth(method="lm") +
  labs(title="Budget vs Revenue",
       x="Budget",
       y="Revenue")
## `geom_smooth()` using formula = 'y ~ x'

cor(movieData$budget_x, movieData$revenue)   
## [1] 0.6738296
ggplot(data = movieData, mapping = aes(x = budget_x, y = profit)) + 
  geom_point() +
  geom_smooth(method="lm") +
  labs(title="Budget vs Profit",
       x="Budget",
       y="Profit")
## `geom_smooth()` using formula = 'y ~ x'

cor(movieData$budget_x, movieData$profit)       
## [1] 0.535381
revenue_mean <- mean(movieData$revenue)
revenue_mean
## [1] 253140093
revenue_sd <- sd(movieData$revenue)
revenue_sd
## [1] 277788049
margin_error <- qnorm(0.975) * (revenue_sd / sqrt(nrow(movieData)))
margin_error
## [1] 5396727

The confidence interval can hence be computed to

lower <- revenue_mean - margin_error 
upper <- revenue_mean + margin_error

paste0("95% CI: [",lower, ", ", upper,"]")
## [1] "95% CI: [247743366.72094, 258536820.11667]"