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 |
Designate string as translated
.(text, n = 1)
.(text, n = 1)
text |
the string to translate |
n |
the number (if applicable) for pluralisation |
Designate string as client-side translated
..(format, values = NULL)
..(format, values = NULL)
format |
a format string |
values |
a string or named list of strings to substitute |
the jmvcore Object classes
Action Analysis Array Column Group Html Image Notice Output Preformatted State Table
Action Analysis Array Column Group Html Image Notice Output Preformatted State Table
An object of class R6ClassGenerator
of length 25.
Determines whether an object is or can be converted to numeric
canBeNumeric(object)
canBeNumeric(object)
object |
the object |
Cell.BEGIN_GROUP adds spacing above a cell
Cell.BEGIN_GROUP Cell.END_GROUP Cell.BEGIN_END_GROUP Cell.NEGATIVE Cell.INDENTED
Cell.BEGIN_GROUP Cell.END_GROUP Cell.BEGIN_END_GROUP Cell.NEGATIVE Cell.INDENTED
An object of class numeric
of length 1.
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
## Not run: table$addFormat(rowNo=1, col=1, Cell.BEGIN_END_GROUP) ## End(Not run)
## Not run: table$addFormat(rowNo=1, col=1, Cell.BEGIN_END_GROUP) ## End(Not run)
A function that creates a color palette
colorPalette(n = 5, pal = "jmv", type = "fill")
colorPalette(n = 5, pal = "jmv", type = "fill")
n |
Number of colors needed |
pal |
Color palette name |
type |
'fill' or 'color' |
a vector of hex color codes
Compose a formula string
composeFormula(lht, rht)
composeFormula(lht, rht)
lht |
list of character vectors making up the left |
rht |
list of character vectors making up the right |
a string representation of the formula
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'
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
composeTerm(components) composeTerms(listOfComponents) decomposeTerm(term) decomposeTerms(terms)
composeTerm(components) composeTerms(listOfComponents) decomposeTerm(term) decomposeTerms(terms)
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 |
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')
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
constructFormula(dep = NULL, terms)
constructFormula(dep = NULL, terms)
dep |
the name of the dependent variable |
terms |
list of character vectors making up the terms |
a string representation of the formula
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'
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'
Used internally by jamovi
create(ns, name, optionsPB, datasetId, analysisId, revision)
create(ns, name, optionsPB, datasetId, analysisId, revision)
ns |
package name |
name |
analysis name |
optionsPB |
options protobuf object |
datasetId |
dataset id |
analysisId |
analysis id |
revision |
revision |
These functions are convenience functions for creating and throwing errors.
createError(formats, code = NULL, ...) reject(formats, code = NULL, ...)
createError(formats, code = NULL, ...) reject(formats, code = NULL, ...)
formats |
a format string which is passed to |
code |
an error code |
... |
additional arguments passed to |
Decompose a formula
decomposeFormula(formula)
decomposeFormula(formula)
formula |
the formula to decompose |
a list of lists of the formulas components
Extracts the error message from an error object
extractErrorMessage(error)
extractErrorMessage(error)
error |
an error object |
Substitutes the arguments into the argument str. See the examples below.
format(str, ..., context = "normal")
format(str, ..., context = "normal")
str |
the format string |
... |
the arguments to substitute into the string |
context |
'normal' or 'R' |
the resultant string
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'
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
isError(object)
isError(object)
object |
the object to test |
TRUE if the object is an error
Marshal the data from an environment into a data frame
marshalData(env, ...)
marshalData(env, ...)
env |
the environment to marshal from |
... |
the variables to marshal |
a data frame
Marshal a formula into options
marshalFormula(formula, data, from = "rhs", type = "vars", permitted = c("numeric", "factor"), subset = ":", required = FALSE)
marshalFormula(formula, data, from = "rhs", type = "vars", permitted = c("numeric", "factor"), subset = ":", required = FALSE)
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
matchSet(x, table)
matchSet(x, table)
x |
the item to find |
table |
the object to search |
the index of where the item appears, or -1 if it isn't present
removes all rows from the data frame which contain missing values (NA)
naOmit(object)
naOmit(object)
object |
the object to remove missing values from |
this function is equivalent to na.omit
from the stats package,
however it preserves attributes on columns in data frames
Different notice levels
NoticeType
NoticeType
An object of class list
of length 4.
The jmv Options classes
Options OptionBool OptionAction OptionList OptionNMXList OptionVariables OptionTerm OptionVariable OptionOutput OptionTerms OptionInteger OptionNumber OptionString OptionLevel OptionGroup OptionPair OptionSort OptionArray OptionPairs
Options OptionBool OptionAction OptionList OptionNMXList OptionVariables OptionTerm OptionVariable OptionOutput OptionTerms OptionInteger OptionNumber OptionString OptionLevel OptionGroup OptionPair OptionSort OptionArray OptionPairs
An object of class R6ClassGenerator
of length 25.
Evaluates a quosure This is intended for use by classes overriding Analysis
resolveQuo(quo)
resolveQuo(quo)
quo |
the quosure to evaluate |
the value of the quosure
Shorthand equivalent to subset(df, select=columnNames)
, however
it additionally preserves attributes on the columns and the data frame
select(df, columnNames)
select(df, columnNames)
df |
the data frame |
columnNames |
the names of the columns to make up the new data frame |
the new data frame
Converts basic R object into their source representation
sourcify(object, indent = "")
sourcify(object, indent = "")
object |
the object to convert to source |
indent |
the level of indentation to use |
a string of the equivalent source code
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))'
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))'
Same as base::startsWith()
and base::endsWith()
except
available for R < 3.3
startsWith(x, prefix) endsWith(x, suffix)
startsWith(x, prefix) endsWith(x, suffix)
x |
a string to test |
prefix |
a string to test the presence of |
suffix |
a string to test the presence of |
Converts a term (a vector of components) into a string for display purposes
stringifyTerm(components, sep = getOption("jmvTermSep", ":"), raise = FALSE)
stringifyTerm(components, sep = getOption("jmvTermSep", ":"), raise = FALSE)
components |
a character vector of components |
sep |
a separator to go between the components |
raise |
whether duplicates should be raised to powers |
the components joined together into a string for disply
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"
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
theme_default(base_size = 16, scale = "none", palette = "jmv")
theme_default(base_size = 16, scale = "none", palette = "jmv")
base_size |
Font size |
scale |
'none' or 'discrete' |
palette |
Color palette name |
the default jmv ggplot2 theme
Creates the hadley jmv ggplot2 theme
theme_hadley(base_size = 16, scale = "none", palette = "jmv")
theme_hadley(base_size = 16, scale = "none", palette = "jmv")
base_size |
Font size |
scale |
'none' or 'discrete' |
palette |
Color palette name |
the hadley jmv ggplot2 theme
Creates the minimal jmv ggplot2 theme
theme_min(base_size = 16, scale = "none", palette = "jmv")
theme_min(base_size = 16, scale = "none", palette = "jmv")
base_size |
Font size |
scale |
'none' or 'discrete' |
palette |
Color palette name |
the minimal jmv ggplot2 theme
Creates the spss jmv ggplot2 theme
theme_spss(base_size = 16, scale = "none", palette = "jmv")
theme_spss(base_size = 16, scale = "none", palette = "jmv")
base_size |
Font size |
scale |
'none' or 'discrete' |
palette |
Color palette name |
the spss jmv ggplot2 theme
Note: uses the . and _ characters rather than + and / allowing these to be used as variable names
toB64(names) fromB64(names)
toB64(names) fromB64(names)
names |
the names to be converted base64 |
Similar to as.numeric
, however if the object has a values
attribute attached, these are used as the numeric values
toNumeric(object)
toNumeric(object)
object |
the vector to convert |
if the expression fails, NaN is returned silently
tryNaN(expr)
tryNaN(expr)
expr |
an expression to evaluate |
the result, or NaN on failure