Package 'jmvcore'

Title: Dependencies for the 'jamovi' Framework
Description: A framework for creating rich interactive analyses for the jamovi platform (see <https://www.jamovi.org> for more information).
Authors: Jonathon Love [aut, cre, cph]
Maintainer: Jonathon Love <[email protected]>
License: GPL (>= 2)
Version: 2.6.3
Built: 2024-11-09 04:38:17 UTC
Source: https://github.com/jamovi/jmvcore

Help Index


Designate string as translated

Description

Designate string as translated

Usage

.(text, n = 1)

Arguments

text

the string to translate

n

the number (if applicable) for pluralisation


Designate string as client-side translated

Description

Designate string as client-side translated

Usage

..(format, values = NULL)

Arguments

format

a format string

values

a string or named list of strings to substitute


the jmvcore Object classes

Description

the jmvcore Object classes

Usage

Action

Analysis

Array

Column

Group

Html

Image

Notice

Output

Preformatted

State

Table

Format

An object of class R6ClassGenerator of length 25.


Determines whether an object is or can be converted to numeric

Description

Determines whether an object is or can be converted to numeric

Usage

canBeNumeric(object)

Arguments

object

the object


Constants to specify formatting of Table cells

Description

Cell.BEGIN_GROUP adds spacing above a cell

Usage

Cell.BEGIN_GROUP

Cell.END_GROUP

Cell.BEGIN_END_GROUP

Cell.NEGATIVE

Cell.INDENTED

Format

An object of class numeric of length 1.

Details

Cell.END_GROUP add spacing below a cell

Cell.BEGIN_END_GROUP add spacing above and below a cell

Cell.NEGATIVE specifies that the cells contents is negative

Examples

## Not run: 

table$addFormat(rowNo=1, col=1, Cell.BEGIN_END_GROUP)

## End(Not run)

A function that creates a color palette

Description

A function that creates a color palette

Usage

colorPalette(n = 5, pal = "jmv", type = "fill")

Arguments

n

Number of colors needed

pal

Color palette name

type

'fill' or 'color'

Value

a vector of hex color codes


Compose a formula string

Description

Compose a formula string

Usage

composeFormula(lht, rht)

Arguments

lht

list of character vectors making up the left

rht

list of character vectors making up the right

Value

a string representation of the formula

Examples

composeFormula(list('a', 'b', c('a', 'b')))
# ~a+b+a:b

composeFormula('f', list('a', 'b', c('a', 'b')))
# "f~a+b+a:b"

composeFormula('with spaces', list('a', 'b', c('a', 'b')))
'`with spaces`~a+b+a:b'

Compose and decompose interaction terms to and from their components

Description

Compose and decompose interaction terms to and from their components

Usage

composeTerm(components)

composeTerms(listOfComponents)

decomposeTerm(term)

decomposeTerms(terms)

Arguments

components

a character vectors of components

listOfComponents

a list of character vectors of components

term

a string with components separated with colons

terms

a character vector of components separated with colons

Examples

composeTerm(c('a', 'b', 'c'))
# 'a:b:c'

composeTerm(c('a', 'b', 'with space'))
# 'a:b:`with space`'

decomposeTerm('a:b:c')
# c('a', 'b', 'c')

decomposeTerm('a:b:`with space`')
# c('a', 'b', 'with space')

Construct a formula string

Description

Construct a formula string

Usage

constructFormula(dep = NULL, terms)

Arguments

dep

the name of the dependent variable

terms

list of character vectors making up the terms

Value

a string representation of the formula

Examples

constructFormula(terms=list('a', 'b', c('a', 'b')))
# a+b+a:b

constructFormula('f', list('a', 'b', c('a', 'b')))
# "f~a+b+a:b"

constructFormula('with spaces', list('a', 'b', c('a', 'b')))
'`with spaces`~a+b+a:b'

Create an analysis

Description

Used internally by jamovi

Usage

create(ns, name, optionsPB, datasetId, analysisId, revision)

Arguments

ns

package name

name

analysis name

optionsPB

options protobuf object

datasetId

dataset id

analysisId

analysis id

revision

revision


Create and throw errors

Description

These functions are convenience functions for creating and throwing errors.

Usage

createError(formats, code = NULL, ...)

reject(formats, code = NULL, ...)

Arguments

formats

a format string which is passed to format

code

an error code

...

additional arguments passed to format


Decompose a formula

Description

Decompose a formula

Usage

decomposeFormula(formula)

Arguments

formula

the formula to decompose

Value

a list of lists of the formulas components


Extracts the error message from an error object

Description

Extracts the error message from an error object

Usage

extractErrorMessage(error)

Arguments

error

an error object


Format a string with arguments

Description

Substitutes the arguments into the argument str. See the examples below.

Usage

format(str, ..., context = "normal")

Arguments

str

the format string

...

the arguments to substitute into the string

context

'normal' or 'R'

Value

the resultant string

Examples

jmvcore::format('the {} was delish', 'fish')

# 'the fish was delish'

jmvcore::format('the {} was more delish than the {}', 'fish', 'cow')

# 'the fish was more delish than the cow'

jmvcore::format('the {1} was more delish than the {0}', 'fish', 'cow')

# 'the cow was more delish than the fish'

jmvcore::format('the {what} and the {which}', which='fish', what='cow')

# 'the cow and the fish'

jmvcore::format('that is simply not {}', TRUE)

# 'that is simply not true'

jmvcore::format('that is simply not {}', TRUE, context='R')

# 'that is simply not TRUE'

Determine if an object is an error

Description

Determine if an object is an error

Usage

isError(object)

Arguments

object

the object to test

Value

TRUE if the object is an error


Marshal the data from an environment into a data frame

Description

Marshal the data from an environment into a data frame

Usage

marshalData(env, ...)

Arguments

env

the environment to marshal from

...

the variables to marshal

Value

a data frame


Marshal a formula into options

Description

Marshal a formula into options

Usage

marshalFormula(formula, data, from = "rhs", type = "vars",
  permitted = c("numeric", "factor"), subset = ":", required = FALSE)

Arguments

formula

the formula

data

a data frame to marshal the data from

from

'rhs' or 'lhs', which side of the formula should be marshalled

type

'vars' or 'terms', the type of the option be marshalled to

permitted

the types of data the option permits

subset

a subset of the formula to marshal

required

whether this marshall is required or not


Determines the index where an item appears

Description

Determines the index where an item appears

Usage

matchSet(x, table)

Arguments

x

the item to find

table

the object to search

Value

the index of where the item appears, or -1 if it isn't present


remove missing values from a data frame listwise

Description

removes all rows from the data frame which contain missing values (NA)

Usage

naOmit(object)

Arguments

object

the object to remove missing values from

Details

this function is equivalent to na.omit from the stats package, however it preserves attributes on columns in data frames


Different notice levels

Description

Different notice levels

Usage

NoticeType

Format

An object of class list of length 4.


The jmv Options classes

Description

The jmv Options classes

Usage

Options

OptionBool

OptionAction

OptionList

OptionNMXList

OptionVariables

OptionTerm

OptionVariable

OptionOutput

OptionTerms

OptionInteger

OptionNumber

OptionString

OptionLevel

OptionGroup

OptionPair

OptionSort

OptionArray

OptionPairs

Format

An object of class R6ClassGenerator of length 25.


Evaluates a quosure This is intended for use by classes overriding Analysis

Description

Evaluates a quosure This is intended for use by classes overriding Analysis

Usage

resolveQuo(quo)

Arguments

quo

the quosure to evaluate

Value

the value of the quosure


Create a new data frame with only the selected columns

Description

Shorthand equivalent to subset(df, select=columnNames), however it additionally preserves attributes on the columns and the data frame

Usage

select(df, columnNames)

Arguments

df

the data frame

columnNames

the names of the columns to make up the new data frame

Value

the new data frame


Converts basic R object into their source representation

Description

Converts basic R object into their source representation

Usage

sourcify(object, indent = "")

Arguments

object

the object to convert to source

indent

the level of indentation to use

Value

a string of the equivalent source code

Examples

sourcify(NULL)

# 'NULL'

sourcify(c(1,2,3))

# 'c(1,2,3)'

l <- list(a=7)
l[['b']] <- 3
l[['c']] <- list(d=3, e=4)
sourcify(l)

# 'list(
#      a=7,
#      b=3,
#      c=list(
#          d=3,
#          e=4))'

Test whether strings start or end with a particular string

Description

Same as base::startsWith() and base::endsWith() except available for R < 3.3

Usage

startsWith(x, prefix)

endsWith(x, suffix)

Arguments

x

a string to test

prefix

a string to test the presence of

suffix

a string to test the presence of


Converts a term into a string

Description

Converts a term (a vector of components) into a string for display purposes

Usage

stringifyTerm(components, sep = getOption("jmvTermSep", ":"),
  raise = FALSE)

Arguments

components

a character vector of components

sep

a separator to go between the components

raise

whether duplicates should be raised to powers

Value

the components joined together into a string for disply

Examples

stringifyTerm(c('a', 'b', 'c'))

# "a:b:c"

stringifyTerm(c('a', 'b', 'c'), sep=' * ')

# "a * b * c"

options('jmvTermSep', ' * ')
stringifyTerm(c('a', 'b', 'c'))

# "a * b * c"

#' stringifyTerm(c('`quoted`', 'b', 'c'))

# "quoted * b * c"

Creates the default jmv ggplot2 theme

Description

Creates the default jmv ggplot2 theme

Usage

theme_default(base_size = 16, scale = "none", palette = "jmv")

Arguments

base_size

Font size

scale

'none' or 'discrete'

palette

Color palette name

Value

the default jmv ggplot2 theme


Creates the hadley jmv ggplot2 theme

Description

Creates the hadley jmv ggplot2 theme

Usage

theme_hadley(base_size = 16, scale = "none", palette = "jmv")

Arguments

base_size

Font size

scale

'none' or 'discrete'

palette

Color palette name

Value

the hadley jmv ggplot2 theme


Creates the minimal jmv ggplot2 theme

Description

Creates the minimal jmv ggplot2 theme

Usage

theme_min(base_size = 16, scale = "none", palette = "jmv")

Arguments

base_size

Font size

scale

'none' or 'discrete'

palette

Color palette name

Value

the minimal jmv ggplot2 theme


Creates the spss jmv ggplot2 theme

Description

Creates the spss jmv ggplot2 theme

Usage

theme_spss(base_size = 16, scale = "none", palette = "jmv")

Arguments

base_size

Font size

scale

'none' or 'discrete'

palette

Color palette name

Value

the spss jmv ggplot2 theme


Convert names to and from Base64 encoding

Description

Note: uses the . and _ characters rather than + and / allowing these to be used as variable names

Usage

toB64(names)

fromB64(names)

Arguments

names

the names to be converted base64


Converts a vector of values to numeric

Description

Similar to as.numeric, however if the object has a values attribute attached, these are used as the numeric values

Usage

toNumeric(object)

Arguments

object

the vector to convert


try an expression, and return NaN on failure

Description

if the expression fails, NaN is returned silently

Usage

tryNaN(expr)

Arguments

expr

an expression to evaluate

Value

the result, or NaN on failure