Change

library(tidyverse) # Tidy data processing and plotting
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggformula) # Formula based plots
Loading required package: scales

Attaching package: 'scales'

The following object is masked from 'package:purrr':

    discard

The following object is masked from 'package:readr':

    col_factor

Loading required package: ggridges

New to ggformula?  Try the tutorials: 
    learnr::run_tutorial("introduction", package = "ggformula")
    learnr::run_tutorial("refining", package = "ggformula")
library(mosaic) # Our go-to package
Registered S3 method overwritten by 'mosaic':
  method                           from   
  fortify.SpatialPolygonsDataFrame ggplot2

The 'mosaic' package masks several functions from core packages in order to add 
additional features.  The original behavior of these functions should not be affected by this.

Attaching package: 'mosaic'

The following object is masked from 'package:Matrix':

    mean

The following object is masked from 'package:scales':

    rescale

The following objects are masked from 'package:dplyr':

    count, do, tally

The following object is masked from 'package:purrr':

    cross

The following object is masked from 'package:ggplot2':

    stat

The following objects are masked from 'package:stats':

    binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
    quantile, sd, t.test, var

The following objects are masked from 'package:base':

    max, mean, min, prod, range, sample, sum
library(skimr) # Another Data inspection package

Attaching package: 'skimr'

The following object is masked from 'package:mosaic':

    n_missing
library(kableExtra) # Making good tables with data

Attaching package: 'kableExtra'

The following object is masked from 'package:dplyr':

    group_rows
library(GGally) # Corr plots
Registered S3 method overwritten by 'GGally':
  method from   
  +.gg   ggplot2
library(corrplot) # More corrplots
corrplot 0.94 loaded
library(ggExtra) # Making Combination Plots

# devtools::install_github("rpruim/Lock5withR")
library(Lock5withR) # Datasets
library(palmerpenguins) # A famous dataset

library(easystats) # Easy Statistical Analysis and Charts
# Attaching packages: easystats 0.7.3 (red = needs update)
✖ bayestestR  0.14.0   ✔ correlation 0.8.5 
✔ datawizard  0.13.0   ✔ effectsize  0.8.9 
✔ insight     0.20.5   ✔ modelbased  0.8.8 
✔ performance 0.12.3   ✔ parameters  0.22.2
✔ report      0.5.9    ✔ see         0.9.0 

Restart the R-Session and update packages with `easystats::easystats_update()`.
library(correlation) # Different Types of Correlations
# From the easystats collection of packages
HollywoodMovies2011 -> movies
glimpse(movies)
Rows: 136
Columns: 14
$ Movie             <fct> "Insidious", "Paranormal Activity 3", "Bad Teacher",…
$ LeadStudio        <fct> Sony, Independent, Independent, Warner Bros, Relativ…
$ RottenTomatoes    <int> 67, 68, 44, 96, 90, 93, 75, 35, 63, 69, 69, 49, 26, …
$ AudienceScore     <int> 65, 58, 38, 92, 77, 84, 91, 58, 74, 73, 72, 57, 68, …
$ Story             <fct> Monster Force, Monster Force, Comedy, Rivalry, Rival…
$ Genre             <fct> Horror, Horror, Comedy, Fantasy, Comedy, Romance, Dr…
$ TheatersOpenWeek  <int> 2408, 3321, 3049, 4375, 2918, 944, 2534, 3615, NA, 2…
$ BOAverageOpenWeek <int> 5511, 15829, 10365, 38672, 8995, 6177, 10278, 23775,…
$ DomesticGross     <dbl> 54.01, 103.66, 100.29, 381.01, 169.11, 56.18, 169.22…
$ ForeignGross      <dbl> 43.00, 98.24, 115.90, 947.10, 119.28, 83.00, 30.10, …
$ WorldGross        <dbl> 97.009, 201.897, 216.196, 1328.111, 288.382, 139.177…
$ Budget            <dbl> 1.5, 5.0, 20.0, 125.0, 32.5, 17.0, 25.0, 80.0, 0.2, …
$ Profitability     <dbl> 64.672667, 40.379400, 10.809800, 10.624888, 8.873292…
$ OpeningWeekend    <dbl> 13.27, 52.57, 31.60, 169.19, 26.25, 5.83, 26.04, 85.…
inspect(movies)

categorical variables:  
        name  class levels   n missing
1      Movie factor    136 136       0
2 LeadStudio factor     34 136       0
3      Story factor     22 136       0
4      Genre factor      9 136       0
                                   distribution
1 30 Minutes or Less (0.7%) ...                
2 Independent (23.5%) ...                      
3 Monster Force (14%), Comedy (10.3%) ...      
4 Action (23.5%), Comedy (19.9%) ...           

quantitative variables:  
                name   class      min          Q1      median         Q3
1     RottenTomatoes integer    4.000   29.250000   53.500000   78.00000
2      AudienceScore integer   24.000   49.500000   61.000000   76.50000
3   TheatersOpenWeek integer    3.000 2550.000000 2995.000000 3400.50000
4  BOAverageOpenWeek integer 1513.000 3778.750000 5685.500000 8923.00000
5      DomesticGross numeric    0.020   19.032500   37.355000   80.45750
6       ForeignGross numeric    0.240   14.250000   47.000000  102.00000
7         WorldGross numeric    0.025   30.706000   76.658500  173.69100
8             Budget numeric    0.200   20.250000   36.500000   70.00000
9      Profitability numeric    0.000    1.064754    2.198864    3.66705
10    OpeningWeekend numeric    0.000    7.710000   13.100000   25.00000
           max        mean           sd   n missing
1     97.00000   53.194030    26.984673 134       2
2     93.00000   61.600000    17.033856 135       1
3   4375.00000 2828.475000   932.702579 120      16
4  93230.00000 8338.825000 10284.468976 120      16
5    381.01000   63.222761    69.417994 134       2
6    947.10000   96.923388   156.437778 121      15
7   1328.11100  150.742343   215.018634 134       2
8    250.00000   53.481343    49.171503 134       2
9     64.67267    3.314521     6.616088 134       2
10   169.19000   20.343308    24.805660 133       3
movies_quant <- movies %>%
  drop_na() %>%
  select(where(is.numeric))
movies_quant
    RottenTomatoes AudienceScore TheatersOpenWeek BOAverageOpenWeek
1               67            65             2408              5511
2               68            58             3321             15829
3               44            38             3049             10365
4               96            92             4375             38672
5               90            77             2918              8995
6               93            84              944              6177
7               75            91             2534             10278
8               35            58             3615             23775
9               69            73             2756              6860
10              69            72             3040              9310
11              49            57             3018              6512
12              26            68             4061             34012
13              35            67             4088             23937
14              56            52             2994              8469
15              71            73             3826             10252
16              82            78             3379             10492
17              83            87             3648             15024
18              23            31             3328              2615
19              23            50             3395             10489
20              93            93             2458              3517
21              93            79             2886              3929
22              82            80             3925             12142
23              55            57             3043              7183
24              85            76             2199              4761
25              71            68             2926              6364
26              34            61             4155             21697
27              61            56             3155              5715
28              92            81             2961              5002
29              93            86             3448              8672
30              37            54             1719              2955
31              30            39             2787              3390
32              60            79             3703             10704
33              38            55             1552              2470
34              47            63             3167              7500
35              47            54             3339              5524
36              38            55             3122              3860
37              60            72             2817              5979
38              35            50             3417             10411
39              77            80             3955             16618
40              26            50             3579             10490
41              78            81             3020              6326
42              38            56             4115             16072
43              22            40             3295              3534
44              19            63             3548              8601
45              78            75             3715             17512
46              20            43             2985              4955
47              71            71             3549              4383
48              72            67             2840              7450
49               4            29             2534              5921
50              46            79             2214              4789
51              58            81             3440              7942
52              72            70             2802              4655
53              36            59             3112             10349
54              58            57             3305              5656
55              32            57             3154              6167
56              84            81             3507              5461
57               4            46             3118              3504
58              35            44             2950              4588
59              10            32             2816              3769
60              76            70             1826              5427
61              84            63             3222              6935
62              87            88             3641             15134
63              83            76             3952              8623
64              14            42             3482              5763
65              71            67             2535              4880
66              11            41             3030              4622
67              95            89             2993              6516
68              38            50             2473              3014
69              44            47             3584              9335
70              84            82             2707              4879
71              88            69             3917              9722
72              24            48             3017              2875
73              34            46             2973              4405
74              84            61                4             93230
75              19            50             1952              5047
76              68            61             3367              7135
77              97            87             3440              8500
78              16            25             2806              2995
79              28            55             2614              3982
80              24            50             3002              1806
81              43            48             2888              4616
82              24            53             2913              4645
83              17            37             2864              5221
84              53            52             2703              4226
85              59            37             2760              3089
86              75            68             3114              2477
87              26            49             3276              3731
88              91            79             2405              3267
89              27            48             3816             13935
90              23            48             3033              6284
91              39            43             2296              3782
92              44            50             3750              9715
93               4            59             3438              7273
94              23            31             2940              6060
95              83            93             1869              2805
96              83            84              247              7174
97              41            59             3606              5889
98               7            38             2661              3055
99              25            48             2986              3132
100             36            52             2996              2835
101             45            38             2290              2265
102             92            82             3376              3537
103             56            65              707              4960
104             22            34             3015              3324
105             26            36             2769              3380
106             50            48             2273              2259
107             46            66              265              3856
108             66            55              106              6111
109             62            57               22              4890
110             36            43             3117              2218
111             38            62             2150              1513
    DomesticGross ForeignGross WorldGross Budget Profitability OpeningWeekend
1           54.01        43.00     97.009    1.5    64.6726667          13.27
2          103.66        98.24    201.897    5.0    40.3794000          52.57
3          100.29       115.90    216.196   20.0    10.8098000          31.60
4          381.01       947.10   1328.111  125.0    10.6248880         169.19
5          169.11       119.28    288.382   32.5     8.8732923          26.25
6           56.18        83.00    139.177   17.0     8.1868824           5.83
7          169.22        30.10    199.324   25.0     7.9729600          26.04
8          254.46       327.00    581.464   80.0     7.2683000          85.95
9           79.25        82.60    161.849   27.0     5.9944074          18.91
10         117.54        92.10    209.638   35.0     5.9896571          28.30
11          70.60        77.10    147.700   25.0     5.9080000          19.70
12         260.80       374.00    634.800  110.0     5.7709091         138.12
13         352.39       770.81   1123.195  195.0     5.7599744          97.85
14          99.97        94.00    193.967   36.0     5.3879722          25.36
15         143.62       341.02    484.634   90.0     5.3848222          39.23
16         127.00       132.71    259.713   50.0     5.1942600          35.45
17         176.70       304.52    481.226   93.0     5.1744731          54.81
18          17.69         7.88     25.562    5.0     5.1124000           8.70
19         142.61       419.54    562.158  110.0     5.1105273          35.61
20          34.90         1.62     36.511    8.0     4.5638750           8.64
21          34.68        32.33     67.007   15.0     4.4671333          11.34
22         165.25       497.78    663.024  150.0     4.4201600          47.66
23          63.69        67.10    130.786   30.0     4.3595333          21.86
24          40.49        13.70     54.194   12.5     4.3355200          10.47
25          55.80        93.74    149.541   35.0     4.2726000          18.62
26         241.07       802.80   1043.871  250.0     4.1754840          90.15
27          42.59       115.30    157.887   40.0     3.9471750          18.03
28          54.71        68.57    123.278   32.0     3.8524375          14.81
29         197.80       336.70    534.500  145.0     3.6862069          29.55
30          13.84        41.40     55.241   15.0     3.6827333           5.08
31          23.20        85.40    108.600   30.0     3.6200000           9.40
32         179.04       261.00    440.040  125.0     3.5203200          39.63
33           8.31       149.63    157.939   45.0     3.5097556           3.83
34          52.70        19.72     72.416   21.0     3.4483810          23.75
35          68.22       119.14    187.355   55.0     3.4064545          18.45
36          36.49        90.90    127.393   40.0     3.1848250          12.05
37          58.71        58.39    117.094   38.0     3.0814211          16.84
38          83.55       128.27    211.818   70.0     3.0259714          35.57
39         181.03       267.48    448.512  150.0     2.9900800          65.72
40         108.09        75.87    183.953   63.0     2.9198889          37.54
41          84.34        58.50    142.841   50.0     2.8568200          19.10
42         191.45       360.40    551.850  200.0     2.7592500          66.14
43          38.54        35.54     74.080   27.0     2.7437037          11.64
44         103.03       111.92    214.945   80.0     2.6868125          30.51
45         176.65       191.75    368.404  140.0     2.6314571          65.06
46          33.00        63.00     96.000   37.0     2.5945946          14.80
47          51.16        10.90     62.053   24.0     2.5855417          15.56
48          62.50        65.37    127.868   50.2     2.5471713          21.16
49          37.30         3.19     40.492   16.0     2.5307500          15.00
50          43.85         0.41     44.267   18.0     2.4592778          10.60
51          83.61       186.20    269.811  110.0     2.4528273          27.32
52          37.41        60.57     97.983   40.0     2.4495750          13.04
53          80.49       102.00    182.485   75.0     2.4331333          32.21
54          38.18        58.96     97.137   40.0     2.4284250          18.69
55          55.10        89.40    144.500   60.0     2.4083333          19.45
56          71.08        16.86     87.947   37.0     2.3769459          19.15
57          28.07        54.00     82.069   35.0     2.3448286          10.93
58          45.06        38.10     83.160   36.0     2.3100000          13.54
59          24.80        66.80     91.600   40.0     2.2900000          10.60
60          31.18        14.25     45.429   20.0     2.2714500           9.91
61          75.64        59.80    135.443   60.0     2.2573833          22.40
62         146.41       207.22    353.623  160.0     2.2101437          55.10
63         142.09       142.30    284.386  130.0     2.1875846          34.08
64          80.36        89.94    170.301   80.0     2.1287625          20.07
65          40.26        23.52     63.781   30.0     2.1260333          12.37
66          37.66        51.50     89.162   42.0     2.1229048          14.01
67          74.21        27.90    102.109   50.0     2.0421800          19.50
68          23.18        16.48     39.664   20.0     1.9832000           7.45
69          98.80       129.00    227.800  120.0     1.8983333          33.50
70          58.01        17.00     75.009   40.0     1.8752250          13.21
71         123.26       121.90    245.154  135.0     1.8159556          38.08
72          20.25       111.90    132.147   75.0     1.7619600           8.67
73          35.61        16.80     52.408   30.0     1.7469333          13.10
74          13.30        41.00     54.303   32.0     1.6969687           0.37
75          27.87         0.97     28.833   17.0     1.6960588           9.85
76          74.50        47.00    121.504   75.0     1.6200533          24.03
77          66.63         5.80     72.426   45.0     1.6094667          29.24
78          18.88        19.83     38.702   25.0     1.5480800           8.40
79          36.67        24.30     60.965   40.0     1.5241250          10.41
80          14.01        16.42     30.426   20.0     1.5213000           5.42
81          37.05         3.49     40.546   28.0     1.4480714          13.33
82          37.08        33.75     70.833   52.0     1.3621731          13.53
83          29.14        49.17     78.308   60.0     1.3051333          14.95
84          29.20        22.00     51.200   40.0     1.2800000          11.40
85          24.05         7.50     31.546   25.0     1.2618400           8.53
86          18.30        18.80     37.102   30.0     1.2367333           7.71
87          33.04        12.70     45.735   40.0     1.1433750          12.22
88          26.69         6.46     33.152   30.0     1.1050667           7.86
89         116.60       103.25    219.851  200.0     1.0992550          53.17
90          36.39        53.40     89.792   82.0     1.0950244          19.06
91          19.49         7.63     27.121   25.0     1.0848400           8.68
92         100.24        74.58    174.821  163.0     1.0725215          36.43
93          68.91        15.00     83.911   79.0     1.0621646          25.00
94          48.50        21.20     69.700   70.0     0.9957143          17.80
95          13.66         9.40     23.057   25.0     0.9222800           5.24
96           5.31         2.95      8.258   10.0     0.8258000           1.75
97          57.31        49.20    106.507  135.0     0.7889407          21.24
98          21.30        17.20     38.502   50.0     0.7700400           8.13
99          25.12        27.84     52.961   70.0     0.7565857           9.35
100         16.93        10.50     27.428   38.0     0.7217895           8.49
101         10.72        18.21     28.931   45.0     0.6429111           5.19
102         33.70        57.50     91.203  150.0     0.6080200          12.07
103         11.54         2.67     14.211   25.0     0.5684400           3.51
104         21.30        27.50     48.795   90.0     0.5421667          10.02
105         21.60         3.26     24.856   49.9     0.4981162           9.36
106         13.07         8.48     21.552   45.0     0.4789333           5.14
107          4.46         9.73     14.190   30.0     0.4730000           1.02
108          4.40         0.40      4.800   15.0     0.3200000           0.64
109          0.97         5.40      6.370   21.0     0.3033333           0.11
110         21.39        17.60     38.992  150.0     0.2599467           6.91
111          7.17         0.24      7.410   41.0     0.1807317           3.25
movies %>%
  gf_point(DomesticGross ~ WorldGross) %>%
  gf_lm() %>%
  gf_labs(
    title = "Scatter Plot",
    subtitle = "Movie Gross Earnings: Domestics vs World"
   )
Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_lm()`).
Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).
Warning: Using the `size` aesthetic with geom_line was deprecated in ggplot2 3.4.0.
ℹ Please use the `linewidth` aesthetic instead.

movies %>%
  gf_point(Profitability ~ Budget) %>%
  gf_lm() %>%
  gf_labs(
    title = "Scatter Plot",
    subtitle = "Movie Gross Earnings: profitiability vs Budget"
   )
Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_lm()`).
Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).

movies %>%
  gf_point(Profitability ~ AudienceScore) %>%
  gf_lm() %>%
  gf_labs(
    title = "Scatter Plot",
    
   )
Warning: Removed 3 rows containing non-finite outside the scale range
(`stat_lm()`).
Warning: Removed 3 rows containing missing values or values outside the scale range
(`geom_point()`).

# names(movies_quant)

GGally::ggpairs(
  movies %>% drop_na(),
  # Select Quant variables only for now
  columns = c(
    "RottenTomatoes", "AudienceScore", "DomesticGross", "ForeignGross", "Budget"
  ),
  switch = "both",
  # axis labels in more traditional locations(left and bottom)

  progress = FALSE,
  # no compute progress messages needed

  # Choose the diagonal graphs (always single variable! Think!)
  diag = list(continuous = "barDiag"),
  # choosing histogram,not density

  # Choose lower triangle graphs, two-variable graphs
  lower = list(continuous = wrap("smooth", alpha = 0.3, se = FALSE)),
  title = "Movies Data Correlations Plot #1"
)
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

movies %>%
  gf_point(Profitability ~ AudienceScore) %>%
  gf_lm() %>%
  gf_labs(
    title = "Scatter Plot"
    
   )
Warning: Removed 3 rows containing non-finite outside the scale range
(`stat_lm()`).
Warning: Removed 3 rows containing missing values or values outside the scale range
(`geom_point()`).