R package jmvReadWrite

Sebastian Jentschke

2020-09-08

The R-package jmvReadWrite reads and writes the .omv-files that are used by the statistical spreadsheet jamovi (www.jamovi.org). It is supposed to ease using syntax for statistical analyses created using the GUI in jamovi in connection with the R-library jmv.

Installation

You can install the development version of the jmvReadWrite package from github.

if(!require(devtools)) install.packages("devtools")
devtools::install_github("sjentsch/jmvReadWrite")

Alternatively, there is a stable version available on CRAN. It can be installed using the following commands

install.packages("jmvReadWrite")

How to use the package?

The following code uses the ToothGrowth-data set that is part of the data sets included in R (the current file contains some modifications though for testing the reading and writing routines: jmvRead and jmvWrite). With this data set, a syntax to conduct an ANOVA is run.

The results should be similar to those obtained when running the same analysis in jamovi (using the GUI). To do so, open the file menu (☰) choose Open, Data Library and ToothGrowth. Afterwards, click on the ANOVA-button in the Analyses-tab and choose ANOVA. There, you assign the variable len to Dependent Variable and supp and dose to Fixed Factors. Afterwards, you choose / tick Overall Model Test and ω². Open the drop-down menu Assumption Checks and tick Homogeneity test and Normality test. The results should be identical apart from that the table output looks nicer in jamovi (not only text, as below), numbers are rounded and maybe one or two other cosmetic differences.

If you want to copy the syntax generated in jamovi, you have to switch on the Syntax Mode. Afterwards, the syntax is shown at the top of the analysis and can be copied from there.

library(jmvReadWrite)
library(jmv)

data = jmvRead(fleNme = system.file("extdata", "ToothGrowth.omv", package = "jmvReadWrite"))
jmv::ANOVA(
    formula = len ~ supp + dose + supp:dose,
    data = data,
    effectSize = c("omega"),
    modelTest = TRUE,
    homo = TRUE,
    norm = TRUE)

 ANOVA

 ANOVA - len                                                                                      
 ──────────────────────────────────────────────────────────────────────────────────────────────── 
                    Sum of Squares    df    Mean Square    F            p             ω²          
 ──────────────────────────────────────────────────────────────────────────────────────────────── 
   Overall model         2740.1033     5      548.02067    41.557178    < .0000001                
   supp                   205.3500     1      205.35000    15.571979     0.0002312    0.0554519   
   dose                  2426.4343     2     1213.21717    91.999965    < .0000001    0.6925788   
   supp:dose              108.3190     2       54.15950     4.106991     0.0218603    0.0236466   
   Residuals              712.1060    54       13.18715                                           
 ──────────────────────────────────────────────────────────────────────────────────────────────── 


 ASSUMPTION CHECKS

 Homogeneity of Variances Test (Levene's) 
 ──────────────────────────────────────── 
   F           df1    df2    p           
 ──────────────────────────────────────── 
   1.940130      5     54    0.1027298   
 ──────────────────────────────────────── 


 Normality Test (Shapiro-Wilk) 
 ───────────────────────────── 
   Statistic    p           
 ───────────────────────────── 
   0.9849884    0.6694242   
 ───────────────────────────── 

The jmvReadWrite-package also enables you to write .omv-files in order to use them in jamovi. Let’s assume that you have a large collection of log-files (e.g., from an experiment) that you compile and process (summarize, filter, etc.) in R in order to later analyse them in jamovi. You will have those processed log-files stored in a data frame (called, e.g., data) which you then write to a file that you can open in jamovi afterwards. Although jamovi reads R-data files (.RData, .rda, .rds) jmvWrite permits to store jamovi-specific attributes (such as variable labels) in addition.

library(jmvReadWrite)

jmvWrite(dtaFrm = data, fleNme = 'Trial.omv')