Logo
25
  • Command Reference
    • Data types
    • Data Import and Export
    • Data cleaning
    • Descriptive statistics and computation
    • Estimation methods
    • Graphics
    • Optimization and Solution
    • Mathematical functions
    • Operators
    • Panel Data
    • Statistical distributions and sampling
    • Time and Date
    • String handling
    • Programming
    • Multithreading and parallelization
    • Web
    • Workspace, files, folders and paths
    • _
    • A
    • B
    • C
    • D
    • E
    • F
    • G
    • H
      • h5create
      • h5open
      • h5readAttribute
      • h5read
      • h5writeAttribute
      • h5write
      • hasimag
      • hasMetaData
      • head
        • Purpose
        • Format
        • Examples
      • headermt
      • header
      • hessMTg
      • hessMTgw
      • hessMTm
      • hessMTmw
      • hessMT
      • hessMTTg
      • hessMTTgw
      • hessMTTm
      • hessMTT
      • hessMTw
      • hessp, hesscplx
      • hess
      • histf
      • histp
      • hist
      • hsec
    • I
    • J
    • K
    • L
    • M
    • N
    • O
    • P
    • Q
    • R
    • S
    • T
    • U
    • V
    • W
    • X
    • Y
    • Z
  • Learning Resources
  • Applications
  • Change Log
GAUSS
  • »
  • Command Reference »
  • H »
  • head
Next Previous

head¶

Purpose¶

Returns the first n rows of a matrix, dataframe or string array.

Format¶

h = head(X[, n])¶
Parameters:
  • X (Matrix, dataframe or string array) – the data to preview.
  • n (Scalar) – Optional input, the number of rows to return. Default = 5. If a negative number is supplied, all except the first n rows will be returned.
Returns:

h (Matrix, dataframe or string array) – The first n rows of X (or all but the first n rows of X, if n is negative).

Examples¶

X = { 11 14,
      27 19,
      44 12,
      81 17,
      23 22,
      14 43 };

head(X);

The above code will print:

11.000000        14.000000
27.000000        19.000000
44.000000        12.000000
81.000000        17.000000
23.000000        22.000000
head(X, 3);

will print out:

11.000000        14.000000
27.000000        19.000000
44.000000        12.000000
head(X, -2);

will print out:

44.000000        12.000000
81.000000        17.000000
23.000000        22.000000
14.000000        43.000000

See also

Functions: rows(), tail()

Next Previous

© Copyright 2025, Aptech Systems, Inc.

Built with Sphinx using a theme provided by Read the Docs.