df_append_real Subroutine

public subroutine df_append_real(df, col, header)

Append a real-valued column to the data frame

Adds a new column of real numbers to the data frame with optional header

@param[in,out] df The data frame instance @param[in] col Array of real values to append @param[in] header Optional column name (if not provided, no header is set)

Warning

All columns must have the same number of rows

Arguments

Type IntentOptional Attributes Name
type(data_frame), intent(inout) :: df
real(kind=rk), intent(in), dimension(:) :: col
character(len=*), intent(in), optional :: header

Source Code

    subroutine df_append_real(df, col, header)
        type(data_frame), intent(inout) :: df
        real(rk), dimension(:), intent(in) :: col
        character(len=*), intent(in), optional :: header

        type(column) :: new_col
        integer :: new_index

        call df % validate_column_addition(header, size(col))
        call df % resize_storage()

        call df % increment_num_cols()
        new_index = df % ncols()
        call new_col % new(col)
        call df % set_data_col(new_index, new_col)

        if (present(header)) then
            call df % set_header_at_index(new_index, header)
        end if
    end subroutine df_append_real