Learn R Programming

statAfrikR (version 0.2.1)

tableau_croise_ins: Tableau croise pondere - format institutionnel INS

Description

Produit un tableau de contingence pondere avec marges, pourcentages et test du chi-deux.

Usage

tableau_croise_ins(
  data,
  ligne,
  colonne,
  poids = NULL,
  type_pct = c("colonne", "ligne", "total"),
  marges = TRUE,
  chi2 = TRUE,
  format = c("tibble", "flextable", "excel"),
  chemin = NULL,
  titre = NULL
)

Value

Tibble, flextable ou chemin Excel

Arguments

data

data.frame, tibble ou svydesign -- Donnees

ligne

character -- Variable en ligne

colonne

character -- Variable en colonne

poids

character ou NULL -- Variable de ponderation. Defaut : NULL

type_pct

character -- "colonne", "ligne" ou "total". Defaut : "colonne"

marges

logical -- Afficher les totaux. Defaut : TRUE

chi2

logical -- Calculer le test du chi-deux. Defaut : TRUE

format

character -- "tibble", "flextable" ou "excel". Defaut : "tibble"

chemin

character ou NULL -- Chemin Excel. Defaut : NULL

titre

character ou NULL -- Titre. Defaut : NULL

Examples

Run this code
set.seed(42)
donnees <- data.frame(
  region = sample(c("Nord", "Sud", "Est", "Ouest"), 300, TRUE),
  milieu = sample(c("urbain", "rural"), 300, TRUE, prob = c(0.4, 0.6)),
  poids  = runif(300, 0.7, 1.4)
)
tableau_croise_ins(donnees, "region", "milieu", poids = "poids")

Run the code above in your browser using DataLab