Learn R Programming

air (version 0.2.2)

whatis: Ask OpenAI to explain what given R code does. The answer is written to console and returned as a string.

Description

Ask OpenAI to explain what given R code does. The answer is written to console and returned as a string.

Usage

whatis(this, call_api = call_openai)

Value

Invisible character string of explanation

Arguments

this

Character string of code to be explained

call_api

Optional function to call another API

Examples

Run this code
# You must provision an OpenAI API key before using this function.
if (FALSE) {
whatis("paste0(vector1, vector2)")
whatis("length(x) %% 2 == 1 ? x[(length(x) + 1) / 2] : NA")
}

Run the code above in your browser using DataLab