Following conventions apply to the easystats-ecosystem, to ensure that function and argument names as well as element names for return-values follow a consistent pattern across all packages.
Importing other packages
No full import, only selective import of functions
Use base-R wherever possible (to reduce hard dependencies)
Make sure R-version requirements are not too strict
Package versioning
Package versions follow Semantic Versioning conventions.
If pull requests include user-visible changes, the “developer” version number should be increased (e.g. from 0.10.1.5 to 0.10.1.6). This ensures that
easystats::install_latest()will download the latest versions.
Helper-functions
- Own re-implementation of helper-functions, if it’s not too much
effort (e.g. I typically use own functions to check if a string starts /
ends with a pattern, or if an object (list, data frame) contains an
element with a given name (like
tibble::has_name()), to reduce dependencies.
print functions
-
printmethods should invisibly return the original (unchanged) input (#65).
Function names
Lower case, underscore separated if more than one verb.
Common prefix for functions that focus on specific “tasks” or workflows (e.g. insight,
get_*()to get data,find_*()to find information, or performance,performance_*()to compute measures of model quality,check_*()to check model assumptions…).Internal functions (that are not exported, like the previously mentioned helper-functions) should always start with a
.(e.g.,.do_some_internal_stuff()).
Argument names
lower case, underscore separated if more than one verb
arguments that refer to plot or table aesthetics (like size or alpha of geoms) should follow the pattern
aesthetics_geomtype, e.g.size_point,color_lineoralpha_rope.easystats uses
byto indicate grouping, notgroup_byorat.Use
selectandexcludeto select columns/variables, andkeepordropto select rows/observations.Handling
NAvalues, especially removing missing values, is done withremove_na.
Element / Column names (for returned data frames)
First letter of the column name is capital, unless (6) applies (example:
Parameter).First letter of nouns is capital, unless (6) applies (example:
ROPE_Percentage,Prior_Scale).Using underscore rather than camelCase to separate words (example:
CI_high).Multiple words: common/main part first and adjective/specifier/variational part after, unless (8) applies (example:
Median_standardized,ROPE_percentage).Abbreviations: all uppercase (example:
ESS,MCSE,ROPE).Keep conventions for reserved words (example:
p,pd,Rhat).Adjectives / verbs: all lower case, unless (1) applies (example:
highorlowinCI_highorCI_low).In case of multiple occurrences of column names that indicate the same measure or content (like
CI_loworSE), the common part is appended as suffix to the context specific part (example:CI_lowandEta2_partial_CI_low, and notCI_lowandCI_low_Eta2_partial).The “squared” term in column names that refers to “common” statistics (
Eta2,Chi2,Omega2, …) should be written as2, notsq,squaredorpétit-deux(example:Chi2, and notChisq,Eta2, and notEta_squared). This rule does not apply to function names.Converting between easystats style and broom style can be done with
insight::standardize_names().
