Note: you may need to install some of these packages if you do not already have them installed.
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.1 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── 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(haven)
library(sjPlot)
library(vtable)
## Loading required package: kableExtra
##
## Attaching package: 'kableExtra'
##
## The following object is masked from 'package:dplyr':
##
## group_rows
auto <- read.csv(file = "Auto.csv")
What is the mean of the mgp variable?
mean(auto$mpg)
## [1] 23.44592
The mean mpg is: [type your answer here]
What is the correlation between horsepower and
mpg?
cor(auto$horsepower, auto$mpg)
## [1] -0.7784268
The correlation between horsepower and mpg
is: [type your answer here]
Here is a scatterplot of the two variables:
plot(x=auto$horsepower, y=auto$mpg)
sessionInfo()
## R version 4.2.3 (2023-03-15 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 22631)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.utf8
## [2] LC_CTYPE=English_United States.utf8
## [3] LC_MONETARY=English_United States.utf8
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.utf8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] vtable_1.4.3 kableExtra_1.3.4 sjPlot_2.8.14 haven_2.5.2
## [5] lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.1
## [9] purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 tibble_3.2.1
## [13] ggplot2_3.5.1 tidyverse_2.0.0
##
## loaded via a namespace (and not attached):
## [1] httr_1.4.5 sass_0.4.5 jsonlite_1.8.4 viridisLite_0.4.1
## [5] splines_4.2.3 modelr_0.1.11 bslib_0.4.2 highr_0.10
## [9] yaml_2.3.7 bayestestR_0.13.1 pillar_1.9.0 backports_1.4.1
## [13] lattice_0.21-8 glue_1.6.2 digest_0.6.31 rvest_1.0.3
## [17] minqa_1.2.5 colorspace_2.1-0 htmltools_0.5.5 Matrix_1.5-3
## [21] pkgconfig_2.0.3 broom_1.0.4 xtable_1.8-4 mvtnorm_1.1-3
## [25] webshot_0.5.4 scales_1.3.0 svglite_2.1.1 tzdb_0.3.0
## [29] lme4_1.1-32 timechange_0.2.0 emmeans_1.8.5 generics_0.1.3
## [33] sjlabelled_1.2.0 cachem_1.0.7 withr_2.5.0 cli_3.6.1
## [37] magrittr_2.0.3 estimability_1.4.1 evaluate_0.20 fansi_1.0.4
## [41] nlme_3.1-162 MASS_7.3-58.3 xml2_1.3.3 tools_4.2.3
## [45] hms_1.1.3 lifecycle_1.0.3 munsell_0.5.0 ggeffects_1.5.2
## [49] compiler_4.2.3 jquerylib_0.1.4 systemfonts_1.0.4 rlang_1.1.0
## [53] grid_4.2.3 nloptr_2.0.3 rstudioapi_0.14 rmarkdown_2.21
## [57] boot_1.3-28.1 gtable_0.3.3 sjstats_0.18.2 sjmisc_2.8.9
## [61] R6_2.5.1 knitr_1.42 performance_0.10.3 fastmap_1.1.1
## [65] utf8_1.2.3 insight_0.19.10 stringi_1.7.12 Rcpp_1.0.10
## [69] vctrs_0.6.1 tidyselect_1.2.0 xfun_0.38 coda_0.19-4.1