Calculate sum of integer column
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(data_frame), | intent(in) | :: | df | |||
| integer, | intent(in) | :: | col_index |
function df_sum_integer(df, col_index) result(total) type(data_frame), intent(in) :: df integer, intent(in) :: col_index integer(ik) :: total 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() total = sum(col) end function df_sum_integer