---
title: "(Put a title here.)"
author: "(Add more info of some sort here?)"
date: "These results are from an *'rmd'* script created 7 December 2021."
output:
  word_document: default
  html_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, comment=NA)
```

##### This [R program](https://en.wikipedia.org/wiki/R_(programming_language)) reads item scores data from an Omega-IScores.csv file, and then invokes the Omega function in the psych package to produce results.

Omega-IScores.csv files are created by Lertap. A reference to the respective Lertap help page is [here](http://www.lertap5.com/HTMLHelp/HTML/index.html?omega1.htm). The psych package's page at the CRAN site is [here](https://cran.r-project.org/web/packages/psych/index.html). A document which discusses the extensive capabilities of the psych package is also [available](https://cran.r-project.org/web/packages/psych/vignettes/overview.pdf); a related document devoted exclusively to omega is [this one](http://personality-project.org/r/psych/HowTo/R_for_omega.pdf). The Schmid-Leiman solution incorporated in the psych package is detailed [here](https://link.springer.com/content/pdf/10.3758/BF03206397.pdf).

```{r echo=FALSE}
library(psych) # Make the functions in the 'psych' package available for use.

#set the working directory to the folder containing this RMD file.
this.dir <- function(directory)
setwd(file.path(getwd(),directory))

```
The Omega-IScores.csv file used in this analysis was obtained from this folder:    


```{r echo=FALSE}

getwd() # Okay, to confirm: R's working directory has been set to:
 
#dir() # Here's a list of the files in the directory: 

```
***
##### A **few** of the data records from the csv file are displayed below. The first column below has a record number inserted by R, the columns to the right of that must have item scores for the items -- _make sure that this is the case._ There **must** only be item scores after the record number. (Refer [here](http://www.lertap5.com/HTMLHelp/HTML/index.html?omega1.htm) for help.)     


```{r echo=FALSE}

MCQitems <- read.csv("Omega-Iscores.csv")

MCQitems <- na.omit(MCQitems) # This weeds out records with missing data

head(MCQitems) # Check: the first few records in the csv file from Lertap look like this: 

```


##### Basic descriptive item statistics are as follows.

```{r echo=FALSE}

describe(MCQitems)

```
 
***
##### Output from the Omega function follows      

 
```{r echo=FALSE}

#date() # Show the date and time
 
omega(MCQitems, digits=3, title="Omega results from the R 'psych' package", echo=FALSE)

```

***

``` {r echo=FALSE}
om <- omegah(MCQitems, digits=3, title="Now display results with three decimal places.")

summary(om, digits=3)

#```
#***

#``` {r echo=FALSE}

#omegaSem(MCQitems, digits=3, factors=1, title="Now use 'omegaSem' to display CFA results.")

#om <- omegaSem(MCQitems, digits=3, factors=1, title="Use 'omegaSem' .")

#summary(om,digits=3)

```
***

##### That's it, all done for now, _adios amigos_, Larry Nelson, l.nelson@curtin.edu.au
