6 Working with tables

submited by
Style Pass
2024-03-28 17:00:13

Goal is a small language and hence doesn’t come with as many specialized features for data frame manipulation as languages like R. Still, Goal is well-suited for many typical data frame handling problems, without requiring to learn how to use any new abstractions or DSLs: most of the functionality is there in the core language, without extra magic. Its small size and fast startup-time can also be an advantage in typical short-running scripts.

To visualize the tables in the various examples, we’ll use for convenience the fmt.tbl[t;r;c;f] formatting function available at lib/fmt.goal in the language’s repository, which displays at most r rows and c columns from a table t, using format string f for numbers.

Recall from the help that import can either take an absolute or relative path, or take a library name with no extension, for example import"fmt", and search for a file "fmt.goal" at any location provided by the GOALLIB environment variable (if set).

In this chapter, we’ll use as data the CSV file found at examples/data/wesnoth-units.csv in Goal’s repository, that contains (simplified) game data for most units from the FOSS game Wesnoth (for version 1.18).

Leave a Comment