ado: Interpret ado code interactively or from a file.

Description Usage Arguments Details Value Interface Disclaimer

Description

An interpreter for a dialect of Stata's ado language. The ado dialect is close to the one Stata provides; see the package vignettes for full details.

The ado package provides an R-based interpreter for a dialect of Stata's ado language. Loops, macros, data manipulation commands and statistics commands are all supported, as are multiple ways to embed R code and use R for writing ado-language commands.

Usage

1
2
ado(df = NULL, filename = NULL, string = NULL, assign.back = FALSE,
  debug_level = 0, print_results = 1, echo = NULL)

Arguments

df

If NULL, start with an empty dataset; if a data.frame, use a copy of the data.frame to initialize the dataset.

filename

The path to an ado script to execute. At least one of filename and string must be NULL.

string

A length-1 character vector to read command input from. At least one of filename and string must be NULL.

assign.back

If TRUE, copy the final dataset state to a variable in the caller's environment on function exit. The variable name is the name (in the caller's environment) of the data.frame passed as the df argument, or if df was NULL, the name "df" is used. The effect is to modify the passed data.frame, though the old value will not necessarily be garbage-collected.

debug_level

How verbose debug messages should be.

print_results

Whether to print command results. Values 0 or 1. The value passed here becomes the ado setting "print_results".

echo

Whether to echo command input. Values 0, 1, and NULL are accepted; if NULL, echo only when running non-interactively.

Details

See the package vignettes for an introduction to the provided ado-language functionality.

Value

Invisible NULL.

Interface

The only entry point from R is the ado() function, which interprets ado code. Command input can be read interactively (from the R prompt), from a file or from a string. The various types of global state that Stata maintains (settings, macros, the dataset, etc) are all kept in internal package data structures that do not persist across calls to the ado() function.

Disclaimer

This package is not in any way affiliated with or endorsed by StataCorp.


wwbrannon/rstata documentation built on May 4, 2019, 12:03 p.m.