### import functions from package openxlsx and xtable.
import(xtable)
import(openxlsx)
importFrom("stats",
           addmargins,
           aggregate,
           chisq.test,
           confint,
           coef,
           cor,
           cor.test,
           family,
           model.frame,
           na.exclude,
           na.pass,
           na.omit,
           na.fail,
           sd,
           terms)

importFrom("utils",
           capture.output,
           write.table)

importFrom("DT",
           datatable)

importFrom("nlme",
           intervals)

importFrom("lmerTest",
           as_lmerModLmerTest)

importFrom("haven",
           as_factor)

importFrom("dplyr",
           "%>%")

### Functions to export to users.
export(
  ## String utility functions (strutil.R).
  "%+%",             # Extends the add function for strings.
  "%n%",             # Repeats s n time (usage: s %n% n)
  "%xyb%",           # operator alias for xyboth
  numtostr,          # Converts a numeric to string. Used by print methods.
  ## Description of continuous variables (desc.R, corr.R, mean.table.R, xf.R).
  correlation,       # This function compute correlation matrices
  #  and associated tests.
  column_types,      # Finds column formats to export data.
  ## Description of categorical variables (freq.R, cross.R).
  cross,             # This function creates a crosstab object which
                     # displays % and statistical test.
  ftab,              # This function adds percentage to a table for display in report.
  xf,                # applies a function across a list of factors.
  xtab,              # Corrects bugs in xtabs associated with NA managements.
  freq,              # displays % of a categorical variable.
  meansd,            # display mean (sd).
  pal_CUFF,          # palette functions
  ## Complementary utility functions.
  ## Print methods.
  print.cross,       # Print function for freq objects.
  print.corr,        # Print function for corr objects.
  print.frequencies, # Print function for frequencies objects.
  ## Compute sums.
  sum.n,             # sumn for a minimum number of valid values.
  Total,             # modification of sum that uses na.rm=TRUE as default
                     # and replaces a result of NA by 0.
  ## Miscelaneous functions
  clip,              # Sends table-like format to clipboard for insert in other programs.
  cf,                # extract coef from common stats models with optional c.i.
  pv,                # format pv as in APA style guide version 6.
  to_csv,            # export data to csv
  view,              # function that send a table-like object to DT::datatable
  xyboth,            # An utility function that show the intersection of two vectors
                     # of indices (list/data.frame of vectors).
  to_csv             # Fonction pour exporter data et format en csv.
)


### Declare S3 methods.
S3method(print, cross)
S3method(print, corr)
S3method(print, frequencies)
S3method(sum,n)

