Skip to contents

Prepares data prompt by summarizing data and printing it

Usage

prep_data_prompt(data, method, prompt)

Arguments

data

A data.frame

method

A summarization method, one of "skimr", "glimpse", or "summary"

prompt

A prompt string

Value

A string

Examples

prep_data_prompt(
  data = mtcars,
  method = "skimr",
  prompt = "This is a test prompt."
)
#> [1] "── Data Summary ────────────────────────\n                           Values\nName                       data  \nNumber of rows             32    \nNumber of columns          11    \n_______________________          \nColumn type frequency:           \n  numeric                  11    \n________________________         \nGroup variables            None  \n\n── Variable type: numeric ──────────────────────────────────────────────────────\n   skim_variable n_missing complete_rate    mean      sd    p0    p25    p50\n\033[38;5;250m 1\033[39m mpg                   0             1  20.1     6.03  10.4   15.4   19.2 \n\033[38;5;250m 2\033[39m cyl                   0             1   6.19    1.79   4      4      6   \n\033[38;5;250m 3\033[39m disp                  0             1 231.    124.    71.1  121.   196.  \n\033[38;5;250m 4\033[39m hp                    0             1 147.     68.6   52     96.5  123   \n\033[38;5;250m 5\033[39m drat                  0             1   3.60    0.535  2.76   3.08   3.70\n\033[38;5;250m 6\033[39m wt                    0             1   3.22    0.978  1.51   2.58   3.32\n\033[38;5;250m 7\033[39m qsec                  0             1  17.8     1.79  14.5   16.9   17.7 \n\033[38;5;250m 8\033[39m vs                    0             1   0.438   0.504  0      0      0   \n\033[38;5;250m 9\033[39m am                    0             1   0.406   0.499  0      0      0   \n\033[38;5;250m10\033[39m gear                  0             1   3.69    0.738  3      3      4   \n\033[38;5;250m11\033[39m carb                  0             1   2.81    1.62   1      2      2   \n      p75   p100\n\033[38;5;250m 1\033[39m  22.8   33.9 \n\033[38;5;250m 2\033[39m   8      8   \n\033[38;5;250m 3\033[39m 326    472   \n\033[38;5;250m 4\033[39m 180    335   \n\033[38;5;250m 5\033[39m   3.92   4.93\n\033[38;5;250m 6\033[39m   3.61   5.42\n\033[38;5;250m 7\033[39m  18.9   22.9 \n\033[38;5;250m 8\033[39m   1      1   \n\033[38;5;250m 9\033[39m   1      1   \n\033[38;5;250m10\033[39m   4      5   \n\033[38;5;250m11\033[39m   4      8   \nThis is a test prompt."