df_max_integer Function

public function df_max_integer(df, col_index) result(max_val)

Find maximum value in integer column

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(in) :: df
integer, intent(in) :: col_index

Return Value integer(kind=ik)


Source Code

    function df_max_integer(df, col_index) result(max_val)
        type(data_frame), intent(in) :: df
        integer, intent(in) :: col_index
        integer(ik) :: max_val

        integer(ik), dimension(:), allocatable :: col
        type(column) :: data_col

        if (col_index < 1 .or. col_index > df % ncols()) error stop "column index out of range"

        data_col = df % get_data_col(col_index)
        if (data_col % get_type() /= INTEGER_NUM) error stop "column is not integer type"

        col = data_col % geti()
        max_val = maxval(col)
    end function df_max_integer