Data Prep

Load Libraries

# if you haven't run this code before, you'll need to download the below packages first
# instructions on how to do this are included in the video
# but as a reminder, you use the packages tab to the right

library(tidyverse) # for the map() command
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.2     ✔ 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(psych) # for the describe() command
## 
## Attaching package: 'psych'
## 
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(naniar) # for the gg_miss-upset() command
library(expss) # for the cross_cases() command
## Loading required package: maditr
## 
## To modify variables or add new variables:
##              let(mtcars, new_var = 42, new_var2 = new_var*hp) %>% head()
## 
## 
## Attaching package: 'maditr'
## 
## The following objects are masked from 'package:dplyr':
## 
##     between, coalesce, first, last
## 
## The following object is masked from 'package:purrr':
## 
##     transpose
## 
## The following object is masked from 'package:readr':
## 
##     cols
## 
## 
## Use 'expss_output_viewer()' to display tables in the RStudio Viewer.
##  To return to the console output, use 'expss_output_default()'.
## 
## 
## Attaching package: 'expss'
## 
## The following object is masked from 'package:naniar':
## 
##     is_na
## 
## The following objects are masked from 'package:stringr':
## 
##     fixed, regex
## 
## The following objects are masked from 'package:dplyr':
## 
##     compute, contains, na_if, recode, vars, where
## 
## The following objects are masked from 'package:purrr':
## 
##     keep, modify, modify_if, when
## 
## The following objects are masked from 'package:tidyr':
## 
##     contains, nest
## 
## The following object is masked from 'package:ggplot2':
## 
##     vars

Import Data

# for the lab, you'll import the CSV file you downloaded along with the current file we're working in (an RMD file)
# for the homework, you'll download the CSV file from your chosen README page (should be titled arc_data_final.csv or eammi2_data_final.csv)
df <- read.csv(file="DATA/fakedata.csv", header=T)

Viewing Data

# these are commands useful for viewing a dataframe
# you can also click the object in the environment tab to view it in a new window
names(df)
##  [1] "id"         "variable1"  "variable2"  "variable3"  "variable4" 
##  [6] "variable5"  "variable6"  "variable7"  "variable8"  "variable9" 
## [11] "variable10" "variable11" "variable12"
head(df)
##     id variable1 variable2 variable3 variable4 variable5 variable6 variable7
## 1 id_1   level b   level d   level a   level b  3.449743 3.4805072  1.039619
## 2 id_2   level b   level c   level a   level c  2.707133 2.6169258  2.280291
## 3 id_3   level b   level b   level b   level b  3.135185 3.2119597  1.854115
## 4 id_4   level c   level d   level b      <NA>  2.901656 0.9048516  1.358520
## 5 id_5   level b   level d   level a      <NA>  2.277099 2.9104901  1.343883
## 6 id_6   level b   level d   level b   level c  2.404385 2.5616353  1.670581
##   variable8 variable9 variable10 variable11 variable12
## 1  4.460219  1.153984   5.056802   1.546471   6.866127
## 2  4.754638  1.474888   4.214870   1.146760   7.208780
## 3  3.518784  1.218142   4.116025   2.746469   5.253641
## 4  4.617069  1.066567   4.670609   1.206538   5.847952
## 5  3.221986  1.374207   4.861695   1.575204   6.936754
## 6  4.892009  1.143127   4.459852   2.765479   6.697210
str(df)
## 'data.frame':    1000 obs. of  13 variables:
##  $ id        : chr  "id_1" "id_2" "id_3" "id_4" ...
##  $ variable1 : chr  "level b" "level b" "level b" "level c" ...
##  $ variable2 : chr  "level d" "level c" "level b" "level d" ...
##  $ variable3 : chr  "level a" "level a" "level b" "level b" ...
##  $ variable4 : chr  "level b" "level c" "level b" NA ...
##  $ variable5 : num  3.45 2.71 3.14 2.9 2.28 ...
##  $ variable6 : num  3.481 2.617 3.212 0.905 2.91 ...
##  $ variable7 : num  1.04 2.28 1.85 1.36 1.34 ...
##  $ variable8 : num  4.46 4.75 3.52 4.62 3.22 ...
##  $ variable9 : num  1.15 1.47 1.22 1.07 1.37 ...
##  $ variable10: num  5.06 4.21 4.12 4.67 4.86 ...
##  $ variable11: num  1.55 1.15 2.75 1.21 1.58 ...
##  $ variable12: num  6.87 7.21 5.25 5.85 6.94 ...

Subsetting Data

# for the HW: use the codebook you created in the codebook activity to get the names of your variables (first column)
# enter this list of names in the select=c() argument to subset those columns from the dataframe
# variables for the lab: id, variable2, variable3, variable5, variable8, variable10, variable11
#this is a comment(notes)
d <- subset(df, select=c(id, variable2, variable3, variable5, variable8, variable10, variable11))

Recoding Variables

# categorical variables need to be recoded as factors
# the content of the variable will stay the same, but R will treat the variable differently at times
d$id <- as.factor(d$id)
d$variable2 <-as.factor(d$variable2)
d$variable3 <-as.factor(d$variable3)

str(d)
## 'data.frame':    1000 obs. of  7 variables:
##  $ id        : Factor w/ 1000 levels "id_1","id_10",..: 1 113 224 335 446 557 668 779 890 2 ...
##  $ variable2 : Factor w/ 6 levels "level a","level b",..: 4 3 2 4 4 4 3 2 4 3 ...
##  $ variable3 : Factor w/ 2 levels "level a","level b": 1 1 2 2 1 2 2 2 2 2 ...
##  $ variable5 : num  3.45 2.71 3.14 2.9 2.28 ...
##  $ variable8 : num  4.46 4.75 3.52 4.62 3.22 ...
##  $ variable10: num  5.06 4.21 4.12 4.67 4.86 ...
##  $ variable11: num  1.55 1.15 2.75 1.21 1.58 ...

Missing Data

we looked at our missing data and had a number of skipped responses (n = 111) we did not notice any meaningful patterns in skipped items and decided to drop particapants who did not respond to any of the items in our analyses. However, the decisions to drop our particapants is not ideal and can lead to the erasure of vulnerable groups, and this is a limitation of our data set and our analyses that we will need to acknowledge in our manuscript.

# use the gg_miss_upset() command for a visualization of your missing data
gg_miss_upset(d[-1], nsets = 6)

# use the na.omit() command to create a new dataframe in which any participants with missing data are dropped from the dataframe
d2 <- na.omit(d)
1000-889
## [1] 111

Exporting Data

# last step is to export the data after you've dropped NAs
# for the HW, the file you're exporting here is what you'll use for all future HW assignments (labs will use the files I provide you)
# make sure you give it a name that is memorable!
# and make sure you save it to your Data folder!
write.csv(d2, file="DATA/fakedata_clean_final.csv", row.names = F)

# since we've created a cleaned dataframe in d2, we'll use that for the rest of the lab/HW

Basic Statistics

Univariate Plots: Histograms & Tables

table(d2$variable2)
## 
## level a level b level c level d level e level f 
##      29     233     351     228      45       3
table(d2$variable3)
## 
## level a level b 
##     200     689
table(d2$variable5)
## 
## 1.165217 1.193308 1.220508 1.289292 1.333703    1.367 1.370468  1.37191 
##        1        1        1        1        1        1        1        1 
## 1.388076 1.394067 1.400497 1.417995 1.419633 1.468049 1.470962 1.491667 
##        1        1        1        1        1        1        1        1 
## 1.492952 1.521317 1.527921  1.53525 1.546769 1.561357 1.581054 1.599799 
##        1        1        1        1        1        1        1        1 
## 1.609974 1.623473 1.633113 1.657962 1.671102 1.674014 1.674073 1.679344 
##        1        1        1        1        1        1        1        1 
## 1.682549 1.687571 1.705482 1.715127 1.722678 1.740639 1.744047 1.751639 
##        1        1        1        1        1        1        1        1 
## 1.752974 1.760229 1.761089 1.772277 1.777421 1.777632 1.779522 1.782423 
##        1        1        1        1        1        1        1        1 
##  1.78545 1.791748 1.802448  1.80265 1.809416 1.809623 1.810046 1.813715 
##        1        1        1        1        1        1        1        1 
## 1.822662 1.825399 1.838925 1.841946 1.843805 1.843836 1.844122 1.844178 
##        1        1        1        1        1        1        1        1 
## 1.850183 1.851513 1.852994 1.855042 1.857881 1.858605 1.858788 1.858864 
##        1        1        1        1        1        1        1        1 
## 1.861468 1.866066 1.868342  1.87855 1.879504 1.879763   1.8844 1.897934 
##        1        1        1        1        1        1        1        1 
## 1.903729 1.912639 1.913241 1.914954 1.916073 1.916987 1.916995  1.92471 
##        1        1        1        1        1        1        1        1 
## 1.928466 1.930702 1.932016 1.937994 1.938525 1.939878 1.940541 1.942105 
##        1        1        1        1        1        1        1        1 
## 1.948646 1.951903 1.952926 1.953837 1.956974 1.958997 1.961791 1.961897 
##        1        1        1        1        1        1        1        1 
## 1.968187 1.968739 1.971802    1.972 1.975547 1.982937 1.985152 1.987039 
##        1        1        1        1        1        1        1        1 
## 1.993109 1.993257 1.994918 1.997865 1.998237 2.000456 2.003092 2.005546 
##        1        1        1        1        1        1        1        1 
## 2.008662 2.009738 2.010439 2.010548 2.011366  2.01379 2.014354 2.015745 
##        1        1        1        1        1        1        1        1 
## 2.020452 2.020464 2.021295 2.026662 2.028614 2.031861 2.036403 2.037305 
##        1        1        1        1        1        1        1        1 
## 2.040426 2.046544 2.048481 2.048671 2.050335 2.050436 2.050524 2.050749 
##        1        1        1        1        1        1        1        1 
## 2.051801 2.052919 2.053075 2.053522 2.055196 2.055929 2.058394 2.058878 
##        1        1        1        1        1        1        1        1 
## 2.060584 2.061903 2.062712  2.06522 2.066177 2.067266 2.067722 2.068168 
##        1        1        1        1        1        1        1        1 
##  2.06932 2.081361 2.081754 2.087851 2.088888 2.089299 2.096919 2.097898 
##        1        1        1        1        1        1        1        1 
## 2.098676 2.100623 2.101234 2.104079 2.107488 2.107884  2.10854 2.109143 
##        1        1        1        1        1        1        1        1 
## 2.110733 2.113489 2.115042 2.115076 2.115195 2.116517 2.121524 2.122294 
##        1        1        1        1        1        1        1        1 
## 2.125424 2.126297 2.127484 2.128301 2.128409 2.128497 2.132775 2.133264 
##        1        1        1        1        1        1        1        1 
## 2.138373 2.138945 2.140817 2.141456 2.141637 2.144249 2.148138 2.150399 
##        1        1        1        1        1        1        1        1 
## 2.151287  2.15217 2.153746 2.157021 2.159211 2.159686 2.161375 2.162935 
##        1        1        1        1        1        1        1        1 
## 2.163306 2.165614 2.165969 2.166077 2.166397 2.167182 2.167401 2.169076 
##        1        1        1        1        1        1        1        1 
## 2.169596 2.171505 2.171562 2.172159 2.174927 2.177995  2.17888 2.180418 
##        1        1        1        1        1        1        1        1 
## 2.180765 2.181956 2.187049 2.187401 2.187736 2.188212  2.18883 2.189435 
##        1        1        1        1        1        1        1        1 
## 2.192152 2.193368 2.194637 2.197851 2.198538 2.201069  2.20226 2.206782 
##        1        1        1        1        1        1        1        1 
## 2.206855 2.207181 2.208463 2.212406 2.213608 2.214615 2.215431 2.218194 
##        1        1        1        1        1        1        1        1 
## 2.218605 2.219029 2.221872 2.225589 2.226729 2.228269 2.228839 2.229979 
##        1        1        1        1        1        1        1        1 
## 2.230103 2.236229 2.236684 2.243327 2.244803 2.244939 2.245511 2.246782 
##        1        1        1        1        1        1        1        1 
## 2.247037 2.248911 2.249418 2.250469 2.251436 2.254594 2.256449 2.258091 
##        1        1        1        1        1        1        1        1 
## 2.260079 2.261973  2.26321 2.265427 2.265478 2.265544 2.265563 2.266315 
##        1        1        1        1        1        1        1        1 
##  2.26859 2.268611 2.269911 2.272303 2.274104  2.27642 2.277099 2.279451 
##        1        1        1        1        1        1        1        1 
## 2.283834 2.284872 2.288185 2.288575 2.288641 2.288828 2.289292 2.291922 
##        1        1        1        1        1        1        1        1 
## 2.296866  2.29908 2.300734 2.301526 2.303579 2.304296 2.304965  2.30614 
##        1        1        1        1        1        1        1        1 
## 2.306955 2.307809 2.309062 2.309396 2.315135 2.315327 2.316206 2.316354 
##        1        1        1        1        1        1        1        1 
## 2.318558 2.318795 2.321039 2.321397 2.322342 2.324844 2.325533 2.325993 
##        1        1        1        1        1        1        1        1 
## 2.326627 2.327479 2.327998 2.328409 2.328989 2.331532 2.331847 2.332503 
##        1        1        1        1        1        1        1        1 
##  2.33285 2.335222 2.335691 2.335977 2.336465 2.337182 2.338919 2.343384 
##        1        1        1        1        1        1        1        1 
## 2.344802 2.346996 2.350142 2.350893 2.350918  2.35133   2.3523 2.353709 
##        1        1        1        1        1        1        1        1 
## 2.355707  2.35869 2.358904 2.359617 2.360536 2.360758 2.362633 2.363515 
##        1        1        1        1        1        1        1        1 
## 2.364937  2.36638 2.367252 2.371454 2.373589 2.373596 2.373734 2.374555 
##        1        1        1        1        1        1        1        1 
## 2.376838 2.380385 2.382384 2.383407  2.38342 2.384913 2.387398 2.388634 
##        1        1        1        1        1        1        1        1 
## 2.389868 2.390587 2.391243 2.396379 2.397222 2.398078 2.398609  2.40008 
##        1        1        1        1        1        1        1        1 
## 2.401253 2.404385 2.405559 2.406838 2.411541 2.414177 2.414565 2.414678 
##        1        1        1        1        1        1        1        1 
## 2.417203 2.417382 2.417719 2.419677 2.422259 2.426497 2.426528  2.42844 
##        1        1        1        1        1        1        1        1 
## 2.430025 2.431018 2.431642 2.435322 2.435815 2.436579 2.437886 2.438519 
##        1        1        1        1        1        1        1        1 
## 2.438541 2.438789 2.438829 2.440881 2.442148 2.446753 2.446809 2.447326 
##        1        1        1        1        1        1        1        1 
## 2.447596 2.449634 2.450161   2.4538 2.455139 2.457625 2.459986 2.462848 
##        1        1        1        1        1        1        1        1 
## 2.462863 2.467311  2.46828 2.468575 2.468651 2.472813 2.473311 2.473887 
##        1        1        1        1        1        1        1        1 
## 2.474272 2.474617 2.479683 2.479953 2.480972  2.48205  2.48612 2.489406 
##        1        1        1        1        1        1        1        1 
## 2.489708 2.491214 2.494123 2.495256 2.497418  2.49883 2.499751 2.499926 
##        1        1        1        1        1        1        1        1 
## 2.499968 2.503687 2.505036 2.505559 2.507184 2.507984 2.509587 2.511304 
##        1        1        1        1        1        1        1        1 
## 2.513105 2.514875 2.517893 2.518622 2.518815 2.518824 2.519039 2.519999 
##        1        1        1        1        1        1        1        1 
##  2.52219 2.522822 2.523814 2.525318 2.525385 2.527787 2.527825  2.52825 
##        1        1        1        1        1        1        1        1 
##  2.52848 2.531175 2.533712 2.535478  2.53613 2.536373 2.536756 2.536824 
##        1        1        1        1        1        1        1        1 
## 2.537107 2.538136  2.53928 2.540043 2.540133 2.545237 2.548786 2.549601 
##        1        1        1        1        1        1        1        1 
## 2.550963 2.553431 2.553981 2.556067 2.556694 2.561236  2.56153 2.561835 
##        1        1        1        1        1        1        1        1 
## 2.564902 2.566986 2.569073 2.570043 2.571668    2.574 2.575617 2.576332 
##        1        1        1        1        1        1        1        1 
## 2.580633 2.586461 2.588484 2.588627 2.589944 2.591783 2.595228 2.596963 
##        1        1        1        1        1        1        1        1 
## 2.596996 2.597378 2.601806 2.607164   2.6078 2.607856 2.608785 2.610168 
##        1        1        1        1        1        1        1        1 
##  2.61159   2.6137 2.619303 2.619375 2.619478 2.621151  2.62211 2.623442 
##        1        1        1        1        1        1        1        1 
## 2.624877 2.626928 2.627572 2.628008 2.629278 2.630172  2.63311  2.63471 
##        1        1        1        1        1        1        1        1 
## 2.636677 2.638053 2.645073  2.64981 2.651922 2.652065 2.653379 2.655922 
##        1        1        1        1        1        1        1        1 
## 2.656499 2.659304 2.659557 2.659844 2.660555 2.662303  2.66327  2.66347 
##        1        1        1        1        1        1        1        1 
## 2.665096 2.665351 2.666044 2.667826 2.669034 2.670332 2.671514 2.672176 
##        1        1        1        1        1        1        1        1 
## 2.672863 2.675114 2.677161 2.677988 2.680336 2.681959 2.683549  2.68952 
##        1        1        1        1        1        1        1        1 
##  2.68987 2.691573 2.692367 2.692671 2.696203 2.698558 2.699255 2.701358 
##        1        1        1        1        1        1        1        1 
## 2.701485 2.701983 2.704916 2.707133 2.707755 2.708105 2.711128 2.717018 
##        1        1        1        1        1        1        1        1 
## 2.717226 2.719814 2.720275 2.722212 2.723453 2.725919 2.726397 2.729118 
##        1        1        1        1        1        1        1        1 
## 2.730001 2.730323 2.730374 2.731369 2.733305 2.734294 2.735193 2.738496 
##        1        1        1        1        1        1        1        1 
## 2.739863 2.742094 2.743755 2.744886 2.745141 2.745566 2.747078 2.749939 
##        1        1        1        1        1        1        1        1 
## 2.750088  2.75609 2.756723 2.759061 2.761547 2.766211 2.769776 2.771177 
##        1        1        1        1        1        1        1        1 
## 2.771707  2.77242 2.773479 2.773939 2.774653 2.776093 2.776809  2.77886 
##        1        1        1        1        1        1        1        1 
## 2.780724 2.783196 2.783787 2.784981 2.785118 2.785863 2.790606 2.793319 
##        1        1        1        1        1        1        1        1 
## 2.793515 2.795983 2.797514 2.797659 2.799948 2.802066 2.803637 2.803781 
##        1        1        1        1        1        1        1        1 
## 2.804364 2.806349 2.806366 2.808146 2.809045 2.809054 2.811143 2.813043 
##        1        1        1        1        1        1        1        1 
## 2.813253 2.815256 2.816583  2.81763 2.818458 2.818898 2.820559 2.820883 
##        1        1        1        1        1        1        1        1 
## 2.821276 2.823644 2.826675   2.8276 2.830256 2.830821 2.831889 2.832266 
##        1        1        1        1        1        1        1        1 
## 2.833305  2.83374 2.835143 2.835652 2.836508 2.838616 2.838618 2.842348 
##        1        1        1        1        1        1        1        1 
## 2.842469 2.842722 2.845415 2.850769 2.851232 2.852601 2.856128 2.857547 
##        1        1        1        1        1        1        1        1 
## 2.858284 2.862366 2.865406 2.868608 2.869441  2.87028 2.871474 2.874537 
##        1        1        1        1        1        1        1        1 
## 2.875014 2.876781 2.878397 2.879241 2.887904 2.888272  2.88952 2.890621 
##        1        1        1        1        1        1        1        1 
## 2.893982 2.897709 2.901656 2.903117 2.907845 2.907956 2.914406 2.917128 
##        1        1        1        1        1        1        1        1 
## 2.920246 2.923606 2.923763 2.924513 2.924553 2.924572  2.92608 2.927241 
##        1        1        1        1        1        1        1        1 
## 2.929462 2.930183 2.935853 2.941554 2.941943 2.942473 2.943347  2.94379 
##        1        1        1        1        1        1        1        1 
## 2.948265 2.948908 2.951775  2.95627 2.956324 2.957395  2.95978  2.96109 
##        1        1        1        1        1        1        1        1 
## 2.968767 2.968871 2.974874 2.978561 2.980164  2.98031 2.983119 2.986005 
##        1        1        1        1        1        1        1        1 
## 2.986056 2.986863 2.987598 2.987799 2.993936 2.994471 2.994548 2.996295 
##        1        1        1        1        1        1        1        1 
## 2.996436 2.997023 3.004557   3.0124 3.012813 3.012947 3.014618 3.014709 
##        1        1        1        1        1        1        1        1 
## 3.015005 3.018077  3.02025 3.031579 3.032651 3.034167 3.035384 3.041872 
##        1        1        1        1        1        1        1        1 
## 3.043798 3.046535  3.04708 3.047759 3.049385 3.050864 3.051991 3.054817 
##        1        1        1        1        1        1        1        1 
## 3.056612 3.059209 3.059361 3.070593 3.072592 3.075459  3.07608 3.079514 
##        1        1        1        1        1        1        1        1 
## 3.080013 3.084239 3.084477 3.086038 3.089721 3.099344 3.101169 3.103135 
##        1        1        1        1        1        1        1        1 
## 3.105337 3.110095 3.110464 3.111472 3.114188  3.11595 3.117141 3.119146 
##        1        1        1        1        1        1        1        1 
## 3.119193 3.119281 3.127276 3.127985 3.129819 3.130527 3.133939 3.135185 
##        1        1        1        1        1        1        1        1 
## 3.141169  3.15328 3.155564 3.158533 3.162835 3.164205  3.16548 3.169641 
##        1        1        1        1        1        1        1        1 
## 3.171358 3.178674 3.181235 3.182592 3.183585 3.186699 3.186774 3.190013 
##        1        1        1        1        1        1        1        1 
## 3.192868 3.193711 3.194957 3.200024 3.204607 3.204895 3.209065 3.216754 
##        1        1        1        1        1        1        1        1 
## 3.217439 3.221533  3.22277 3.225865 3.229082  3.22995 3.231255 3.236862 
##        1        1        1        1        1        1        1        1 
## 3.236872 3.242538 3.245192  3.24959 3.250865 3.253422 3.255953  3.25947 
##        1        1        1        1        1        1        1        1 
## 3.259486 3.265376  3.26922 3.269306 3.271594 3.275353 3.290098 3.291769 
##        1        1        1        1        1        1        1        1 
## 3.318416   3.3233 3.323932 3.325711  3.33848 3.342747 3.357232 3.363124 
##        1        1        1        1        1        1        1        1 
## 3.364825 3.376615 3.385781 3.394105  3.39668 3.397383 3.406345 3.418364 
##        1        1        1        1        1        1        1        1 
## 3.421655 3.431081 3.434036 3.449743 3.454636 3.455281 3.463095  3.47602 
##        1        1        1        1        1        1        1        1 
## 3.476926 3.507667 3.517753 3.519795 3.525752 3.540311 3.540705  3.54778 
##        1        1        1        1        1        1        1        1 
##  3.55997 3.562625 3.565717  3.59286 3.596634 3.689492 3.721341 3.721504 
##        1        1        1        1        1        1        1        1 
## 3.736184 3.806276 3.815089 3.826072 3.847441 3.904458 3.910202  3.99994 
##        1        1        1        1        1        1        1        1 
## 4.151068 
##        1
hist(d2$variable5)

hist(d2$variable8)

hist(d2$variable10)

hist(d2$variable11)

Univariate Normality

describe(d2)
##            vars   n   mean     sd median trimmed    mad  min    max  range
## id*           1 889 503.18 285.14 504.00  503.65 364.72 1.00 999.00 998.00
## variable2*    2 889   3.04   0.94   3.00    3.02   1.48 1.00   6.00   5.00
## variable3*    3 889   1.78   0.42   2.00    1.84   0.00 1.00   2.00   1.00
## variable5     4 889   2.53   0.49   2.51    2.52   0.50 1.17   4.15   2.99
## variable8     5 889   3.89   0.65   3.96    3.93   0.68 1.36   5.00   3.63
## variable10    6 889   4.87   0.97   4.90    4.90   0.95 1.04   6.98   5.94
## variable11    7 889   1.82   0.61   1.72    1.76   0.64 1.00   3.99   2.99
##             skew kurtosis   se
## id*        -0.01    -1.18 9.56
## variable2*  0.15    -0.30 0.03
## variable3* -1.32    -0.27 0.01
## variable5   0.14    -0.07 0.02
## variable8  -0.57     0.03 0.02
## variable10 -0.35     0.27 0.03
## variable11  0.83     0.15 0.02

Bivariate Plots

Crosstabs

cross_cases(d2, variable2, variable3)
 variable3 
 level a   level b 
 variable2 
   level a  5 24
   level b  56 177
   level c  79 272
   level d  46 182
   level e  13 32
   level f  1 2
   #Total cases  200 689

Scatterplots

plot(d2$variable5, d2$variable8,
     main="Scatterplot of variable5 and variable8",
     xlab = "variable5",
     ylab = "variable8")

plot(d2$variable10, d2$variable11,
     main="Scatterplot of variable10 and variable11",
     xlab = "variable10",
     ylab = "variable11")

Boxplots

boxplot(data=d2, variable5~variable2,
        main="Boxplot of variable5 and variable2",
        xlab = "x (variable2)",
        ylab = "Y (variable5)")

boxplot(data=d2, variable8~variable3,
        main="Boxplot of variable8 and variable3",
        xlab = "x (variable3)",
        ylab = "Y (variable8)")