This is an RStudio addin function that should become available after the package is installed.
Details
Highlight text in an editor window while using Rstudio, then select the addin from the drop-down menu.
This function sends the selected text to a gpt-4 model and returns the output to the document, not the console.
The selected text is replaced with the original text, a new line, and the response from the model.