Home > database >  How to loop in tbl_cross
How to loop in tbl_cross

Time:05-21

I have seven variables X1,...,X7 I need to crosstabulate all my variables: X1 with 6 others. Is it possible to do it and how with tbl_cross?

AGR %>% 
  tbl_cross(
    row=X1,
    col =X2,
    percent = "row",
    digits = c(0, 1))

CodePudding user response:

@Scott Hunter: R language.

tbl_cross is function that creates a cross table of two categorical variables. see enter image description here Created on 2022-05-20 by the reprex package (v2.0.1)

  • Related