Create or change contents of column in current H2O frame


Create new column

    _h2oframe _generate newcolname =exp

Replace contents of existing column

    _h2oframe _replace oldcolname =exp [if] [in]


_h2oframe _generate creates a new column. The values of the column are specified by =exp. See Using functions and expressions for more information about specifying expressions with H2O frames.

The new column type is determined by the type of result returned by =exp. A numeric column (real or int) is created if the result is numeric, and a string column is created if the result is a string. See What is an H2O frame? for more information about the data types in an H2O frame.

_h2oframe _replace changes the contents of an existing column.


     . webuse genxmpl3
     . _h2oframe _put, into(genxmpl3)
     . _h2oframe _change genxmpl3

 Create new column age2 containing the values of age squared
     . _h2oframe _generate age2 = age^2

     . webuse genxmpl1, clear
     . _h2oframe _put, into(genxmpl1)
     . _h2oframe _change genxmpl1

 Replace the values in age2 with those of age^2
     . _h2oframe _replace age2 = age^2

     . webuse genxmpl2, clear
     . _h2oframe _put, into(genxmpl2)
     . _h2oframe _change genxmpl2

 Create column upname with the contents of name, but in uppercase
     . _h2oframe _generate upname = toupper(name)
     . _h2oframe _get genxmpl2, clear
     . list