navigation map

Chapters:
  1: Introduction
  2: Simple example
  3: Invocation
  4: Finer Control
  5: X-Y Plots
  6: Contour Plots
  7: Image Plots
  8: Examples
  9: Gri Commands
  10: Programming
  11: Environment
  12: Emacs Mode
  13: History
  14: Installation
  15: Gri Bugs
  16: Test Suite
  17: Gri in Press
  18: Acknowledgments
  19: License

Indices:
  Concepts
  Commands
  Variables
index.html#Top HandlingData.html#HandlingData Gri: handling headers Gri: column algebra index.html#Top Gri: column algebra

8.12.2: Ignoring columns that are not of interest

Quite often a dataset will have many columns, of which only a couple are of interest to you. Consider for example oceanographic data which has columns storing, in order, these variables: (1) depth in water column, (2) "in situ" temperature, (3) "potential" temperature, (4) salinity, (5) conductivity, (6) density, (7) sigma-theta, (8) sound speed, and (9) oxygen concentration. But you might only be interested in plotting a graph of salinity on the x-axis and depth on the y-axis. Here are several ways to do this:


open file
read columns y * * x
draw curve

where the `*' is a place-keeper to indicate to skip that column. For a large number of columns, or as an aesthetic choice, you might prefer to write this a


open file
read columns y=1 x=4
draw curve

Many users would just as soon not bother with this syntax, preferring instead to use system tools with which they are more familiar. So a Gawk user might write


open "gawk '{print($1, $4)}' file |"
read columns y x
draw curve

For more on the Gawk command see see Awk.

navigation map