Note: You will ALWAYS leave this first RMarkdown code chunk as is. Because it contains “include=FALSE” in the curly brackets {} the chunk text will NOT appear when you knit it.

Note: Please delete all the sample text after previous code chuck that auto-populates in new RMarkdown files. Then proceed with the Lab.

Reflection Questions

How was the install process? Anything I should know for future students?

Please type your answer here.

Have you used any statistical software before?

Please type your second answer here.

Installing new packages

#install.packages("psych")
#install.packages("psychTools")

#If you wish to write text inside of a code chuck OR block out code so it does not run, ad a "#" to the beginning of each line

When packages are installed, their names must always be enclosed by double quotation marks (” “).

Calling packages to use in file

library(psych)
library(psychTools)
## Warning: package 'psychTools' was built under R version 4.3.3

When packages are called, their names are NOT enclosed by double quotation marks (” “).

Call in the sample data “epi.bfi” from the PsychTools package

data(epi.bfi)

#This is a small data set of 5 scales from the Eysenck Personality Inventory, 5 from a Big 5 inventory, a Beck Depression Inventory, and State and Trait Anxiety measures. 

# Run the summary function to get some basic stats on all of the dataset's variables

summary(epi.bfi)
##       epiE            epiS            epiImp          epilie     
##  Min.   : 1.00   Min.   : 0.000   Min.   :0.000   Min.   :0.000  
##  1st Qu.:11.00   1st Qu.: 6.000   1st Qu.:3.000   1st Qu.:1.000  
##  Median :14.00   Median : 8.000   Median :4.000   Median :2.000  
##  Mean   :13.33   Mean   : 7.584   Mean   :4.368   Mean   :2.377  
##  3rd Qu.:16.00   3rd Qu.: 9.500   3rd Qu.:6.000   3rd Qu.:3.000  
##  Max.   :22.00   Max.   :13.000   Max.   :9.000   Max.   :7.000  
##     epiNeur         bfagree          bfcon           bfext      
##  Min.   : 0.00   Min.   : 74.0   Min.   : 53.0   Min.   :  8.0  
##  1st Qu.: 7.00   1st Qu.:112.0   1st Qu.: 99.0   1st Qu.: 87.5  
##  Median :10.00   Median :126.0   Median :114.0   Median :104.0  
##  Mean   :10.41   Mean   :125.0   Mean   :113.3   Mean   :102.2  
##  3rd Qu.:14.00   3rd Qu.:136.5   3rd Qu.:128.5   3rd Qu.:118.0  
##  Max.   :23.00   Max.   :167.0   Max.   :178.0   Max.   :168.0  
##      bfneur           bfopen           bdi            traitanx    
##  Min.   : 34.00   Min.   : 73.0   Min.   : 0.000   Min.   :22.00  
##  1st Qu.: 70.00   1st Qu.:110.0   1st Qu.: 3.000   1st Qu.:32.00  
##  Median : 90.00   Median :125.0   Median : 6.000   Median :38.00  
##  Mean   : 87.97   Mean   :123.4   Mean   : 6.779   Mean   :39.01  
##  3rd Qu.:104.00   3rd Qu.:136.5   3rd Qu.: 9.000   3rd Qu.:44.00  
##  Max.   :152.00   Max.   :173.0   Max.   :27.000   Max.   :71.00  
##     stateanx    
##  Min.   :21.00  
##  1st Qu.:32.00  
##  Median :38.00  
##  Mean   :39.85  
##  3rd Qu.:46.50  
##  Max.   :79.00

Run the histogram and mean (statistical average) functions on the “bdi” variable (Beck Depression Inventory)

# To specify a variable from the data, within the chosen function's parentheses enter the dataset name followed by "$" (dollar symbol), then the variable name.

hist(epi.bfi$bdi)

mean(epi.bfi$bdi)
## [1] 6.779221

This is the end of the First R Code lab – you did it!