Calculate standard deviation of integer column
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(data_frame), | intent(in) | :: | df | |||
integer, | intent(in) | :: | col_index |
function df_std_integer(df, col_index) result(stddev) type(data_frame), intent(in) :: df integer, intent(in) :: col_index real(rk) :: stddev integer(ik), dimension(:), allocatable :: col real(rk) :: avg 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() avg = df_mean_integer(df, col_index) stddev = sqrt(sum((real(col, rk) - avg)**2) / real(size(col) - 1, rk)) end function df_std_integer