describe_omv {jmvReadWrite}R Documentation

Adds a title and a description for a data set stored as .omv-file for the statistical spreadsheet 'jamovi' (https://www.jamovi.org)

Description

Adds a title and a description for a data set stored as .omv-file for the statistical spreadsheet 'jamovi' (https://www.jamovi.org)

Usage

describe_omv(
  dtaInp = NULL,
  fleOut = "",
  dtaTtl = c(),
  dtaDsc = c(),
  usePkg = c("foreign", "haven"),
  selSet = "",
  ...
)

Arguments

dtaInp

Either a data frame or the name of a data file to be read (including the path, if required; "FILENAME.ext"; default: NULL); files can be of any supported file type, see Details below

fleOut

Name of the data file to be written (including the path, if required; "FILE_OUT.omv"; default: ""); if empty, the resulting data frame is returned instead

dtaTtl

Character vector with a title to be added to the data set (see Details; default: "")

dtaDsc

Description of the data set, either as character vector (HTML-formatted) or as named list with the entries "description", "variables", "references", and "license" (see Details; default: "")

usePkg

Name of the package: "foreign" or "haven" that shall be used to read SPSS, Stata and SAS files; "foreign" is the default (it comes with base R), but "haven" is newer and more comprehensive

selSet

Name of the data set that is to be selected from the workspace (only applies when reading .RData-files)

...

Additional arguments passed on to methods; see Details below

Details

Value

a data frame (only returned if fleOut is empty) where the order of variables / columns of the input data set is re-arranged

See Also

describe_omv internally uses the following functions for reading and writing data files in different formats: read_omv() and write_omv() for jamovi-files, utils::read.table() for CSV / TSV files, load() for reading .RData-files, readRDS() for .rds-files, haven::read_sav() or foreign::read.spss() for SPSS-files, haven::read_dta() or foreign::read.dta() for Stata-files, haven::read_sas() for SAS-data-files, and haven::read_xpt() or foreign::read.xport() for SAS-transport-files.

Examples

## Not run: 
dtaFrm <- jmvReadWrite::ToothGrowth[, c("len", "supp", "dose")]
nmeOut <- tempfile(fileext = ".omv")

# the paste's underneath are only for readability (without them, the vignettes are misformatted)
lstDsc <- list(description = paste("The response is the length of odontoblasts (cells responsible",
                                   "for tooth growth) in 60 guinea pigs. Each animal received one",
                                   "of three dose levels of vitamin C (0.5, 1, and 2 mg / day) by",
                                   "one of two delivery methods, orange juice or ascorbic acid (a",
                                   "form of vitamin C and coded as VC)."),
               variables = list(len  = "Tooth length",
                                supp = "Supplement type (VC or OJ)",
                                dose = "Dose (in milligrams / day"),
               references = paste("Crampton, E. W. (1947). The growth of the odontoblast of the",
                                  "incisor teeth as a criterion of vitamin C intake of the guinea",
                                  "pig. <em>The Journal of Nutrition, 33</em>(5), 491-504.",
                                  "https://doi.org/10.1093/jn/33.5.491"),
               license = "")
jmvReadWrite::describe_omv(dtaInp = dtaFrm, fleOut = nmeOut, dtaTtl = "ToothGrowth",
  dtaDsc = lstDsc)
# don't include the unlink, if you copy the code and want to look at the resulting output file
unlink(nmeOut)

# the code underneath should cover all formatting options jamovi is able to use (paste0 is only
# for readability)
chrDsc <- paste0("<p><strong>Trial – all formattings:</strong><br/><strong>bold</strong><br/>",
                 "<strong><em>bold, italics</em></strong><br/><em>italics</em><br/><u>underlined",
                 "</u><br/>link:<a href=\"https://jamovi.org\" target=\"_blank\">https://",
                 "jamovi.org</a><br/><s>strikethrough</s><br/>C<sub>2</sub>H<sub>5</sub>",
                 "OH<br/>R<sup>2</sup><br/><span style=\"background-color:#e60000\">background ",
                 "colour: red</span><br/><span style=\"color:#e60000\">foreground color: red",
                 "</span></p><p class=\"ql-align-center\">centered</p><p class=\"ql-align-right\">",
                 "right</p><p class=\"ql-align-justify\">justify justify justify justify justify ",
                 "justify justify justify justify justify justify justify justify justify justify ",
                 "justify justify justify justify justify justify justify justify justify justify",
                 "</p><p><br/></p><ol><li>numbered list</li><li>numbered list</li></ol><p><br/>",
                 "</p><ul><li>bullet point</li><li>bullet point</li></ul><p class=\"ql-indent-1\">",
                 "indented once</p><p class=\"ql-indent-2\">indented twice</p><p ",
                 "class=\"ql-indent-1\">indented once</p><p>Formula: <span class=\"ql-formula\">",
                 "e=mc^2</span></p><pre>Preformatted</pre><p>normal again</p><h2>Heading</h2>")
jmvReadWrite::describe_omv(dtaInp = dtaFrm, fleOut = nmeOut, dtaTtl = "ToothGrowth",
  dtaDsc = chrDsc)
unlink(nmeOut)

## End(Not run)


[Package jmvReadWrite version 0.4.7 Index]