Script AI
Menu location: AI assistance on the toolbar of the R script window or the report window.
AI assistance opens the Script AI pane beside the script window. Ask it about the script, about what R printed, or about the methods and how to go on, and it answers in the conversation and suggests R code. The answers come from ChatGPT through your own ChatGPT account: what you ask and what you choose to share go to OpenAI under your agreement with them, and your plan's allowance for Codex applies. StatsDirect has no account of its own and sends nothing until you press Send. Enter in the question box sends the question; Shift+Enter adds a line. The assistant cannot run R or change your documents; it proposes code for you to run.
The first time, Use my ChatGPT sets the connection up. StatsDirect downloads OpenAI's own component, about 123 MB, from OpenAI's release on GitHub, checks that it is the file expected, and installs it for your Windows account; then the sign-in page opens in your browser. Your work stays open throughout, and a question you had typed is kept. No API key is needed. You stay signed in from one session to the next until you sign out, through the button at the top of the pane, which also says how you are connected. Your existing ChatGPT chats are not brought in.
Each Send sends your question and the recent conversation. Under Sharing for this session, choose whether to share the current script and its output (or the current report), Share open workbook data, or neither. Workbook sharing covers every open workbook, not just the active one; close any workbook you do not want included. Before confirming, check all shared content for person identifiers such as names, dates of birth, patient identifiers and identifying free text. Confirmation is remembered for the application session. Opening or closing a workbook changes the sharing scope and requires confirmation again; switching between the same open workbooks does not.
The assistant lists approved workbooks and reads only the worksheet ranges it needs, with at most 32 columns and 4,000 cells in one read. It does not silently sample a larger selection. Workbook names can repeat, so check the workbook, worksheet, range and columns named in the answer. A question uses the documents and versions approved when it was sent; editing or closing a shared workbook while a reply is in progress stops access to stale data. Turning sharing off prevents further reads, but content already shared remains in that conversation.
The reply appears in the conversation as it is written, with headings, lists and tables, and R code in blocks with Copy and Open in R. Open in R on a block, or Open R code under the conversation for the last reply, opens a new script window holding the code with what it needs before it: the script as it was shared, the fixed worksheet values the assistant read from each workbook, and the code of earlier replies, each part labelled. Separate read snapshots keep their own workbook, sheet and range information, even when workbooks have the same name. Later edits to a workbook do not replace the values used for that reply. Nothing runs until you press Run, and the status line asks you to review suggested code first. Copy R code copies the last reply's code for pasting elsewhere. Stop ends a reply. The conversation follows a reply while you are reading its end, and stays where you are if you have scrolled up or selected text.
The pane docks at the right of the window. Pop out makes it a window of its own and Dock brings it back; Close hides it, keeping the conversation and any question not yet sent. Each script has its own conversation, kept while the script is open and gone when it closes; New conversation starts afresh, and what was shared before is not carried into it. If the connection drops, the status line says why and Send connects again.
An organisation can switch the assistant off for its users with the policy value DisableOnlineTutor, a DWORD other than zero under Software\Policies\StatsDirect in HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER; the pane then says AI disabled by policy.
Help > Learning opens the lesson library, where the same tutor teaches statistics with StatsDirect and R, and Learning Options sets its preferences.