01.データの種類

visualize(
  diamonds, 
  xvar = "color", 
  type = "dist", 
  custom = FALSE
)

result <- pivotr(
  diamonds, 
  cvars = c("color", "clarity"), 
  nr = 8
)
summary(result)
Pivot table
Data        : diamonds 
Categorical : color clarity 

 clarity   D   E   F   G   H   I   J Total
      I1   4   5  11   5   8   5   2    40
     SI2  68 106  93  97  86  46  33   529
     SI1 111 147 125  95 117  76  50   721
     VS2  89 139 128 119  88  56  42   661
     VS1  50  52  83 112  70  50  25   442
    VVS2  41  56  49  78  33  20   7   284
    VVS1  17  37  45  70  32  20   3   224
      IF   2  12  31  21  20  11   2    99
   Total 382 554 565 597 454 284 164 3,000
# dtab(result) %>% render()
visualize(
  diamonds, 
  xvar = "color", 
  type = "dist", 
  fill = "clarity", 
  custom = FALSE
)

result <- explore(
  diamonds, 
  vars = "price", 
  fun = c("n_obs", "mean", "min", "max", "sd"), 
  nr = 1
)
summary(result)
Explore
Data        : diamonds 
Functions   : n_obs, mean, min, max, sd 
Top         : Function 

 variable n_obs      mean min    max        sd
    price 3,000 3,907.186 338 18,791 3,956.915
# dtab(result) %>% render()
visualize(
  diamonds, 
  xvar = "price", 
  type = "dist", 
  custom = FALSE
)

result <- explore(
  diamonds, 
  vars = "price", 
  byvar = "color", 
  fun = c("n_obs", "mean", "min", "max", "sd"), 
  nr = 7
)
summary(result)
Explore
Data        : diamonds 
Grouped by  : color 
Functions   : n_obs, mean, min, max, sd 
Top         : Function 

 color variable n_obs      mean min    max        sd
     D    price   382 3,217.003 399 18,114 3,278.276
     E    price   554 3,284.596 361 18,426 3,610.872
     F    price   565 3,654.492 357 18,678 3,779.511
     G    price   597 3,970.573 364 18,791 4,002.082
     H    price   454 4,250.302 338 18,745 4,063.648
     I    price   284 4,869.190 367 18,371 4,570.572
     J    price   164 5,642.012 339 17,451 4,574.576
# dtab(result) %>% render()