Skip to contents

Pipe mode: a pipe-terminal verb that sends a prompt to Copilot augmented with the piped data context. The piped object is described via str() and attached to the prompt. Returns .data invisibly (pipe passthrough).

Usage

hal_ask(.data, ...)

Arguments

.data

In pipe mode: an R object (data frame, model, etc.) piped in. In standalone mode: the first prompt string.

...

Character strings forming the prompt.

Value

Pipe mode: invisibly returns .data (pipe passthrough). Standalone: invisibly returns the response text.

Details

Standalone mode: called directly with a string prompt to ask a question without data context. Returns the response text invisibly.

Spawns a disposable session – does NOT pollute the main hal() conversation.

Examples

if (FALSE) { # \dontrun{
# Pipe mode (data-aware analysis)
mtcars |> hal_ask("what are the key patterns?")
lm(mpg ~ wt, data = mtcars) |> hal_ask("interpret these coefficients")

# Standalone mode (general question)
hal_ask("what does the pipe operator do in R?")
hal_ask("explain", "the difference between <- and =")
} # }