Initializing playground…
← Back to roadmap

📋 readTable — Interactive Playground

Parse delimiter-separated text into a DataFrame with readTable(). Mirrors pandas read_table() — identical to readCsv() but defaults to a tab (\t) separator.
Edit any code block below and press ▶ Run (or Ctrl+Enter) to execute it live in your browser.

1 · Basic tab-separated file

By default readTable() splits on tabs, infers column dtypes, and returns a DataFrame.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

2 · Custom separator

Pass sep to use any delimiter — pipe, semicolon, or multi-character strings.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

3 · Handling missing values

readTable() recognises common NA strings (NA, N/A, null, …) and converts them to NaN. Extend the list with naValues.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

4 · Index column, row limits & skip rows

Use indexCol to promote a column to the row index. nRows caps the number of data rows read; skipRows skips rows after the header.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

API Reference

Parse a delimiter-separated text string into a DataFrame. Defaults to tab (\t) unlike readCsv which uses a comma.

readTable(text: string, options?: ReadTableOptions): DataFrame

interface ReadTableOptions {
  sep?:      string;                     // separator (default: "\t")
  header?:   number | null;              // header row index (default: 0)
  indexCol?: string | number | null;     // column to use as row index
  dtype?:    Record<string, DtypeName>; // force dtype for named columns
  naValues?: readonly string[];          // extra NA string values
  skipRows?: number;                     // data rows to skip after header
  nRows?:    number;                     // maximum data rows to read
}