The code feature allows you to run R-code with access to all functions and data in Radiant. By clicking the
Run code button, the code will be evaluated and the output will be shown on the right of the R > Code page. To evaluate only a part of the code use the cursor to select a section and press CTRL-return (CMD-return on mac).
You can load an R-code file into Radiant by clicking the
Choose File button and selecting an .r or .R file. If you started Radiant from Rstudio you can save a report in HTML, Word, or PDF format by selecting the desired format from the drop-down manu and clicking
Save. To save just the code choose
R-code from the dropdown and press the
As an example you can copy-and-paste the code below into the editor and press
Run code to generate results.
```r## get the active dataset and show the first few observations .getdata() %>% head
r_data[[‘diamonds’]] %>% select(price, clarity) %>% head
dat <- r_data[[‘diamonds’]] dat\(log_price <- log(dat\)price)
dat %>% select(price, log_price) %>% head
dat %>% ggplot(aes(x = price)) + geom_histogram()
dat %>% ggplot(aes(x = log_price)) + geom_histogram()
help(package = ‘radiant’)