Skip to content

Frequency tables #380

Open
Open
@Beliavsky

Description

@Beliavsky

For a 1D array of integer or character data, one often wants to summarize the frequency of observations. One could have a subroutine returning two allocatable arrays of equal size, one an array of distinct values and the other an integer array of counts, for example

subroutine frequencies(ivec,ival,icount)
integer, intent(in) :: ivec(:)
integer, intent(out), allocatable :: ival(:) ! unique values
integer, intent(out), allocatable :: icount(:) ! counts of unique values
end subroutine frequencies

For integer, character, and logical 1D arrays one could define a MODE function that returns the most common value. The mode of continuous data is often not meaningful, so I exclude REAL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions