H2O frame functions¶
The following lists all H2O functions that Stata supports. These functions are mainly used in H2O expressions when creating or replacing the contents of the columns in the current H2O frame, or when filtering observations. The functions are organized under the following headings:
Datetime functions¶
 day(dt)
    Description:     the numeric day corresponding to a time column
    Domain dt:       a time column
    Range:           an int column with integers 1 to 31 or missing
 dow(dt)
    Description:     the numeric day of the week corresponding to a time column
    Domain dt:       a time column
    Range:           an enum column with values Mon, Tue, Wed, Thu, Fri, Sat, Sun,
                     or missing
 hour(dt)
    Description:     the hour corresponding to a time column
    Domain dt:       a time column
    Range:           an int column with integers 0 through 23 or missing
 minute(dt)
    Description:     the minute corresponding to a time column
    Domain dt:       a time column
    Range:           an int column with integers 0 through 59 or missing
 month(dt)
    Description:     the numeric month corresponding to a time column
    Domain dt:       a time column
    Range:           an int column with integers 1 to 12 or missing
 second(dt)
    Description:     the second corresponding to a time column
    Domain dt:       a time column
    Range:           an int column with integers 0 through 59 or missing
 week(dt)
    Description:     the numeric week of the year corresponding to a time column
                     Note: The first week of a year is the first 7-day period of the
                     year.
    Domain dt:       a time column
    Range:           an int column with integers 1 to 52 or missing
 year(dt)
    Description:     the numeric year corresponding to a time column
    Domain dt:       a time column
    Range:           an int column with integers 1 to 9999 or missing
Mathematical functions¶
 abs(x)
    Description:  the absolute value of x
    Domain:       -infinity to infinity or missing
    Range:        0 to infinity or missing
 
 ceil(x)
    Description:  the unique integer n such that n - 1 < x < n;
                  or missing if x is missing
                  Also see floor(x), round(x), and trunc(x).
    Domain:       -infinity to infinity or missing
    Range:        integers in -infinity to infinity or missing
 exp(x)
    Description:  the exponential function of e^x
                  This function is the inverse of log(x).
    Domain:       -infinity to infinity or missing
    Range:        0 to infinity or missing
 expm1(x)
    Description:  e^x - 1
    Domain:       -infinity to infinity or missing
    Range:        -1 to infinity or missing
 
 floor(x)
    Description:  the unique integer n such that n <= x < n + 1;
                  or missing if x is missing
                  Also see ceil(x), round(x), and trunc(x).
    Domain:       -infinity to infinity or missing
    Range:        integers in -infinity to infinity or missing
 log(x)
    Description:  the natural logarithm
    Domain:       c(epsdouble) to infinity or missing
    Range:        -infinity to infinity or missing
 log10(x)
    Description:  the base-10 logarithm of x
    Domain:       c(epsdouble) to infinity or missing
    Range:        -infinity to infinity or missing
 log1p(x)
    Description:  the natural logarithm of 1+x
    Domain:       -1+c(epsdouble) to infinity or missing
    Range:        -infinity to infinity or missing
 log2(x)
    Description:  the base-2 logarithm of x
    Domain:       c(epsdouble) to infinity or missing
    Range:        -infinity to infinity or missing
 
 round(x,digits) or round(x)
    Description:   x rounded to the number of decimal places specified by digits
                   If digits is not specified, x will be rounded to an integer.
                   For rounding, H2O uses the "rounding half to even" mode
                   (IEC 60559 standard). For example, round(2.5) = 2 and
                   round(3.5) = 4. Also see ceil(x), floor(x), and trunc(x).
    Domain x:      -infinity to infinity or missing
    Domain digits: integers >= 0
    Range:         -infinity to infinity or missing
 sign(x)
    Description:  the sign of x: -1 if x < 0, 0 if x = 0, 1 if x > 0, or missing
                  if x is missing
    Domain:       -infinity to infinity or missing
    Range:        -1, 0, 1, or missing
 sqrt(x)
    Description:  the square root of x
    Domain:       0 to infinity or missing
    Range:        0 to infinity or missing
 
 trunc(x)
    Description:  the integer obtained by truncating x toward 0 (thus, trunc(5.2) = 5
                  and trunc(-5.8) = -5), or missing if x is missing
                  Also see ceil(x), floor(x), and round(x).
    Domain:       -infinity to infinity or missing
    Range:        integers in -infinity to infinity or missing
String functions¶
 nchar(s)
    Description:  the number of characters in string s
    Domain s:     strings
    Range:        integers >= 0
 tolower(s)
    Description:  lowercase characters in string s
    Domain s:     strings
    Range:        strings with lowercase characters
 lstrip(s) or lstrip(s,prefix)
    Description:   s without leading characters
                   Note: The prefix argument specifies that the string prefix be
                   removed from the string if it is found at the beginning of the
                   string.
    Domain s:      strings
    Domain prefix: strings
    Range:         strings without leading characters
 rstrip(s) or rstrip(s,suffix)
    Description:   s without trailing characters
                   Note: The suffix argument specifies that the string suffix be
                   removed from the string if it is found at the end of the string.
    Domain s:      strings
    Domain suffix: strings
    Range:         strings without trailing characters
 toupper(s)
    Description:  uppercase characters in string s
    Domain s:     strings
    Range:        strings with uppercase characters
 substring(s,n1,n2)
    Description:  the substring of s, starting at n1, for a length of n2
                  If n1 is greater than the length of the string, an empty string is
                  returned; if n2 = . (missing), the remaining portion of the string
                  is returned.
    Domain s:     strings
    Domain n1:    integers >= 1
    Domain n2:    integers >= 1
    Range:        strings
Trigonometric functions¶
 acos(x)
    Description:  the radian value of the arccosine of x
    Domain:       -1 to 1 or missing
    Range:        0 to pi or missing
 acosh(x)
    Description:  the inverse hyperbolic cosine of x,
                  acosh(x) = ln{x+sqrt(x*x - 1)}
    Domain:       1 to infinity or missing
    Range:        0 to infinity or missing
 asin(x)
    Description:  the radian value of the arcsine of x
    Domain:       -1 to 1 or missing
    Range:        -pi/2 to pi/2 or missing
 asinh(x)
    Description:  the inverse hyperbolic sine of x,
                  asinh(x) = ln{x+sqrt(x*x + 1)}
    Domain:       -infinity to infinity or missing
    Range:        -infinity to infinity or missing
 atan(x)
    Description:  the radian value of the arctangent of x
    Domain:       -infinity to infinity or missing
    Range:        -pi/2 to pi/2 or missing
 atanh(x)
    Description:  the inverse hyperbolic tangent of x,
                  atanh(x) = (1/2){ln(1+x) - ln(1-x)}
    Domain:       -1 to 1 or missing
    Range:        -infinity to infinity or missing
 cos(x)
    Description:  the cosine of x, where x is in radians
    Domain:       -infinity to infinity or missing
    Range:        -1 to 1 or missing
 cosh(x)
    Description:  the hyperbolic cosine of x,
                  cosh(x) = {exp(x) + exp(-x)}/2
    Domain:       -infinity to infinity or missing
    Range:        1 to infinity or missing
 sin(x)
    Description:  the sine of x, where x is in radians
    Domain:       -infinity to infinity or missing
    Range:        -1 to 1 or missing
 sinh(x)
    Description:  the hyperbolic sine of x,
                  sinh(x) = {exp(x) - exp(-x)}/2
    Domain:       -infinity to infinity or missing
    Range:        -infinity to infinity or missing
 tan(x)
    Description:  the tangent of x, where x is in radians
    Domain:       -infinity to infinity or missing
    Range:        -infinity to infinity or missing
 tanh(x)
    Description:  the hyperbolic tangent of x,
                  tanh(x) = {exp(x) - exp(-x)}/{exp(x) + exp(-x)}
    Domain:       -infinity to infinity or missing
    Range:        -1 to 1 or missing