Branch Coverage

blib/lib/Rstats/Func.pm
Criterion Covered Total %
branch 657 802 81.9


line true false branch
25 9 77 unless is_character($r, $x1)
28 72 14 unless (defined $x_levels)
33 85 1 unless defined $x_exclude
36 1 85 if (defined $x_exclude->value and Rstats::Func::length($r, $x_exclude)->value)
41 1 2 if (defined $x_levels_value and defined $x_exclude_value and $x_levels_value eq $x_exclude_value)
49 2 1 unless $match
55 79 7 unless (defined $x_labels)
60 75 11 unless defined $x_ordered
66 1 85 if ($labels_length == 1 and get_length($r, $x1) != 1) { }
0 85 elsif ($labels_length != $levels_length) { }
84 1 346 if (not defined $x1_value) { }
89 340 6 exists $levels->{$x1_value} ? :
96 7 79 if ($x_ordered) { }
113 1 3 ref $_[-1] eq 'HASH' ? :
124 172 9 !is_list($r, $_) ? :
138 1 44 if ref $data[0] and is_data_frame($r, $data[0])
151 31 82 if (is_character($r, $v) and not grep({$_ eq 'AsIs';} @{$v->class->values;}))
156 0 113 if (@$dim_values > 1) { }
164 0 0 if (my $count = $name_count->{$name}) { }
178 2 111 if (my $count = $name_count->{$name}) { }
197 0 113 if ($max_count % $count != 0)
207 1 112 if ($repeat > 1)
239 0 75 unless defined $x1
244 66 9 if defined $x_nrow
248 63 12 if defined $x_ncol
252 1 74 if defined $x_byrow
256 9 66 if (not defined $nrow || defined $ncol) { }
1 65 elsif (not defined $nrow) { }
3 62 elsif (not defined $ncol) { }
274 0 75 if (get_type($r, $x1) eq 'character') { }
0 75 elsif (get_type($r, $x1) eq 'complex') { }
70 5 elsif (get_type($r, $x1) eq 'double') { }
0 5 elsif (get_type($r, $x1) eq 'integer') { }
5 0 elsif (get_type($r, $x1) eq 'logical') { }
293 1 74 if ($byrow) { }
317 46 15 if (@_) { }
319 46 0 if ($dimnames_list->{'object_type'} eq 'list') { }
324 92 0 if (is_character($r, $x_dimname)) { }
334 44 2 if (is_data_frame($r, $x1))
343 5 10 if (exists $x1->{'dimnames'}) { }
358 3 16 if (@_) { }
361 1 2 unless (exists $x1->{'dimnames'})
369 10 6 if (defined $x1->{'dimnames'}[0])
382 3 15 if (@_) { }
385 2 1 unless (exists $x1->{'dimnames'})
393 9 6 if (defined $x1->{'dimnames'}[1])
410 1 1 if (exists $x1->{'list'}) { }
427 11 32 if (is_factor($r, $x1)) { }
431 32 0 is_character($r, $x1) ? :
448 4 10 if ($x1_dim_count == 2) { }
481 1 1 unless defined $x_names
521 2 1 if (is_character($r, $new_v))
528 2 3 if ($new_name eq $name)
534 1 2 if ($found_pos == -1) { }
562 2 7 unless defined $v->value($index)
581 0 0 unless defined $x_all
582 0 0 unless defined $x_all_x
583 0 0 unless defined $x_all_y
585 0 0 if ($x_all) { }
0 0 elsif ($x_all_x) { }
0 0 elsif ($x_all_y) { }
599 0 0 unless defined $x_by
600 0 0 unless defined $x_by_x
601 0 0 unless defined $x_by_y
606 0 0 defined $x_sort ? :
623 4 33 if ($type_level->{$type1} > $type_level->{$type2}) { }
649 0 4 unless open my $fh, '<', $file
653 1 3 defined $x_sep ? :
654 0 4 defined $x_encoding ? :
655 1 3 defined $x_skip ? :
656 1 3 defined $x_header ? :
663 2 12 if ($skip > 0)
670 1 11 if ($header_opt and not $header)
680 0 11 if $current_row_size != $row_size
690 5 32 if (defined Rstats::Util::looks_like_na($row[$i])) { }
4 28 elsif (defined Rstats::Util::looks_like_logical($row[$i])) { }
10 18 elsif (defined Rstats::Util::looks_like_integer($row[$i])) { }
10 8 elsif (defined Rstats::Util::looks_like_double($row[$i])) { }
4 4 elsif (defined Rstats::Util::looks_like_complex($row[$i])) { }
714 2 9 if (defined $header->[$i]) { }
721 1 10 if ($type eq 'character') { }
1 9 elsif ($type eq 'complex') { }
4 5 elsif ($type eq 'double') { }
4 1 elsif ($type eq 'integer') { }
752 2 3 ref $_[-1] eq 'HASH' ? :
757 4 1 unless defined $x_sep
760 4 1 unless defined $x_drop
766 5 6 if not defined $max_length or $length > $max_length
785 1 4 if ($x_drop) { }
814 3 2 unless defined $x_length
825 13 34 if ($j > $k)
829 3 44 if ($level > @$levels)
838 4 1 unless defined $x_labels
839 4 1 unless defined $x_ordered
849 1 1 defined $x1_diag ? :
852 2 0 if (is_matrix($r, $x1_m)) { }
860 12 12 if ($diag) { }
861 9 3 $col >= $row ? :
864 6 6 $col > $row ? :
884 1 1 defined $x1_diag ? :
887 2 0 if (is_matrix($r, $x1_m)) { }
895 12 12 if ($diag) { }
896 6 6 $col <= $row ? :
899 3 9 $col < $row ? :
921 1 1 if (get_length($r, $x1) == 1) { }
948 0 0 $x1_dim_values->[0] < $x1_dim_values->[1] ? :
967 0 2 if $x1->get_type ne $x2->get_type
971 1 1 get_length($r, $x1_dim) > get_length($r, $x2_dim) ? :
1020 0 1 if $x1->get_type ne $x2->get_type
1059 1 1 defined $x1_ignore_case ? :
1063 2 4 if (not defined $x) { }
1067 2 2 if ($ignore_case) { }
1091 1 1 defined $x1_ignore_case ? :
1095 2 4 if (not defined $x) { }
1099 2 2 if ($ignore_case) { }
1121 1 1 defined $x1_ignore_case ? :
1128 4 2 unless (not defined $x)
1129 2 2 if ($ignore_case) { }
1130 2 0 if ($x =~ /$pattern/i)
1135 1 1 if ($x =~ /$pattern/)
1151 1 126 if ($seq_str =~ s/^(.+)\*//)
1157 127 0 if ($seq_str =~ /([^\:]+)(?:\:(.+))?/)
1160 0 127 unless defined $to
1193 1 2 if (not defined $x) { }
1200 0 2 if $@
1216 0 5 unless $x1_x->get_type eq 'character' and $x1_table->get_type eq 'character'
1228 10 6 if ($x1_table_char =~ /$x1_x_char_q/)
1233 0 6 if ($match_count == 0) { }
4 2 elsif ($match_count == 1) { }
2 0 elsif ($match_count > 1) { }
1254 1 4 if (is_data_frame($r, $x1)) { }
1 3 elsif (is_list($r, $x1)) { }
1270 0 2 if $x1->get_type ne $x2->get_type
1279 0 18 if ($type eq 'character') { }
9 9 elsif ($type eq 'double' or $type eq 'integer') { }
9 0 elsif ($type eq 'complex') { }
1280 0 0 if ($x1_value eq $x2_value)
1286 3 6 if ($x1_value == $x2_value)
1292 3 6 if ($x1_value->{'re'} == $x2_value->{'re'} and $x1_value->{'im'} == $x2_value->{'im'})
1298 6 2 $match ? :
1309 0 3 if $x1->get_type ne $x2->get_type
1314 1 2 if get_length($r, $x3) ne get_length($r, $x4)
1320 1 3 unless ($x3_elements->[$i] == $x4_elements->[$i])
1326 1 1 $not_equal ? :
1334 0 1 if $x1->get_type ne $x2->get_type
1342 2 5 if ($x1_element == $x2_element)
1347 2 2 unless $match
1358 0 1 if $x1->get_type ne $x2->get_type
1365 2 14 if ($x1_element == $x2_element)
1379 0 1 if $x1->get_type ne $x2->get_type
1410 1 0 if ($x1->get_type eq 'character') { }
1413 1 2 if (is_na($r, $x1_element)) { }
1436 1 0 if ($x1->get_type eq 'character') { }
1439 1 2 if (is_na($r, $x1_element)) { }
1462 1 0 if ($x1->get_type eq 'character') { }
1465 1 2 if (is_na($r, $x1_element)) { }
1495 2 13 if ($x1_element == $x2_element)
1501 2 2 if ($match) { }
1520 2 1 unless defined $x_after
1523 2 1 if is_null($r, $x_after)
1543 0 4 unless @xs
1545 2 2 if (is_data_frame($r, $xs[0])) { }
1550 2 2 if ($first_row_length) { }
1551 0 2 if $x->{'row_length'} != $first_row_length
1557 0 2 if $different
1582 0 6 if (is_matrix($r, $x1)) { }
6 0 elsif (is_vector($r, $x1)) { }
1594 2 4 unless defined $row_count_needed
1595 0 6 if $row_count_needed ne $row_count
1627 1 0 if (@$dim_values == 2) { }
1646 1 0 if (@$dim_values == 2) { }
1669 0 1 unless (get_length($r, $x1))
1680 0 3 if (is_na($r, $element)) { }
0 3 elsif (is_nan($r, $element)) { }
1686 2 1 if ($element > $max and not is_nan($r, $max))
1700 0 1 unless (get_length($r, $x1))
1710 0 3 if (is_na($r, $element)) { }
0 3 elsif (is_nan($r, $element)) { }
1716 2 1 if ($element < $min and not is_nan($r, $min))
1731 126 242 ref $_[-1] eq 'HASH' ? :
1736 140 1320 if (exists $opt->{$name}) { }
592 728 elsif ($i < @_) { }
1755 37 2 unless defined $x1_mod
1756 37 2 unless defined $x1_arg
1760 3 36 if (get_length($r, $x1_mod) or get_length($r, $x1_arg)) { }
1763 1 2 $x1_mod_length > $x1_arg_length ? :
1769 1 2 unless defined $x_mod
1771 1 2 unless defined $x_arg
1782 0 36 unless is_numeric($r, $x1_re) and is_numeric($r, $x1_im)
1789 39 1 if (defined $x1_re_elements->[$i]) { }
1831 2 3 defined $x_n ? :
1833 2 3 if (is_data_frame($r, $x1)) { }
1834 0 2 $x1->{'row_length'} < $n ? :
1843 1 2 get_length($r, $x1) < $n ? :
1874 2 1 if ($x1_value) { }
1894 1 5 unless (get_length($r, $x1))
1903 1 13 if (is_na($r, $element)) { }
2 11 elsif (is_nan($r, $element)) { }
1909 11 2 if (not is_nan($r, $max) and value($r, $element > $max))
1934 1 5 unless (get_length($r, $x1))
1943 1 13 if (is_na($r, $element)) { }
2 11 elsif (is_nan($r, $element)) { }
1949 0 13 if (not is_nan($r, $min) and value($r, $element < $min))
1959 3 2 ref $_[-1] eq 'HASH' ? :
1982 21 3 if $comp != 0
1987 3 2 !$decreasing ? :
1990 16 3 if $comp != 0
2004 0 1 ref $_[-1] eq 'HASH' ? :
2043 2 1 ref $_[-1] eq 'HASH' ? :
2045 1 2 unless defined $sep
2066 6 2 if not defined $maxs[$i] or $elements->[$i] > $maxs[$i]
2083 6 2 if not defined $mins[$i] or $elements->[$i] < $mins[$i]
2108 0 2 unless @xs
2110 1 1 if (is_data_frame($r, $xs[0])) { }
2115 1 1 if ($first_names) { }
2118 0 1 if @$first_names != @$names
2120 0 2 if $names->[$i] ne $first_names->[$i]
2122 0 1 if $different
2136 2 2 if (is_factor($r, $v)) { }
2168 11 0 defined $x_times ? :
2192 0 9 if $x2_elements_h->{$x2_element_hash} > 1
2201 9 21 if ($x2_elements_h->{$hash}) { }
2230 0 1 ref $_[-1] eq 'HASH' ? :
2234 0 1 if $count < 1
2238 1 0 unless defined $mean
2241 1 0 unless defined $sd
2264 1 6 ref $_[-1] eq 'HASH' ? :
2266 3 4 unless defined $digits
2267 2 5 unless defined $digits
2286 1 0 if (@$dim_values == 2) { }
2306 1 0 if (@$dim_values == 2) { }
2324 3 1 ref $_[-1] eq 'HASH' ? :
2333 0 4 unless defined $length
2335 0 4 if $length > $x1_length and not $replace
2344 55 100 if $replace
2372 1 2 defined $x_n ? :
2375 1 2 get_length($r, $x1) < $n ? :
2409 78 1 if (is_vector($r, $x1)) { }
2414 3 483 if (is_na($r, $x1_element)) { }
2415 2 1 unless ($na_count)
2422 392 91 unless ($elements_count->{$str})
2445 1 1 if ($x3_length % 2 == 0) { }
2473 1 2 if ($x3_length % 4 == 0) { }
2486 1 2 if ($x3_length % 2 == 0) { }
2499 1 2 if ($x3_length % 4 == 0) { }
2550 2 1 if (&$cond_cb($x1_values->[$i]))
2563 2 2 if (is_null($r, $x1) or is_null($r, $x2))
2568 2 0 if is_vector($r, $x1)
2570 2 0 if is_vector($r, $x2)
2573 2 0 if (is_matrix($r, $x1) and is_matrix($r, $x2)) { }
2575 0 2 if get_length($r, $x1) == 0 or get_length($r, $x2) == 0
2577 1 1 unless dim($r, $x1)->values->[1] == dim($r, $x2)->values->[0]
2622 1 4 if (is_data_frame($r, $x1)) { }
1 3 elsif (is_list($r, $x1)) { }
2637 132 7 ref $_[-1] eq 'HASH' ? :
2641 1 138 if (defined $_along) { }
2650 128 10 unless defined $from
2651 0 138 unless defined $from
2654 128 10 unless defined $to
2655 0 138 unless defined $to
2663 0 138 if (defined $length and defined $by)
2667 135 3 unless (defined $by)
2668 134 1 if ($to >= $from) { }
2675 0 138 if $by == 0
2677 0 138 unless defined $to
2679 1 137 if (defined $length and $from ne $to)
2684 2 136 if ($to == $from) { }
134 2 elsif ($to > $from) { }
2688 0 134 if ($by < 0)
2699 0 2 if ($by > 0)
2729 904 233 if (ref $datx2) { }
2734 212 21 if ($reverse) { }
2753 1 32977 if ($length == 0) { }
1 32976 elsif ($length > 1) { }
2764 0 32977 if ($type eq 'character' or $type eq 'complex') { }
3 32974 elsif ($type eq 'double') { }
32974 0 elsif ($type eq 'integer' or $type eq 'logical') { }
2768 0 3 if ($value eq 'Inf' or $value eq '-Inf') { }
0 3 elsif ($value eq 'NaN') { }
2785 0 32977 unless (defined $value)
2795 50 8 if ($x1->{'object_type'} eq 'NULL' or $x1->{'object_type'} eq 'array' or $x1->{'object_type'} eq 'factor') { }
6 2 elsif ($x1->{'object_type'} eq 'list') { }
2 0 elsif ($x1->{'object_type'} eq 'data.frame') { }
2816 2 996 ref $_[-1] eq 'HASH' ? :
2819 12 986 if (is_factor($r, $x1)) { }
2826 997 1 unless defined $dim_drop
2827 997 1 unless defined $level_drop
2832 998 0 if (@_indexs) { }
2837 0 0 ref $at eq 'ARRAY' ? :
2848 24 974 if ($x1->get_type eq 'character') { }
0 974 elsif ($x1->get_type eq 'complex') { }
962 12 elsif ($x1->get_type eq 'double') { }
12 0 elsif ($x1->get_type eq 'integer') { }
0 0 elsif ($x1->get_type eq 'logical') { }
2877 1 997 if ($level_drop)
2895 4 556 if ($is_factor)
2899 4 556 if is_factor($r, $x1)
2913 560 0 if (@$values) { }
2914 550 10 if ($dim_length == 1) { }
7 3 elsif ($dim_length == 2) { }
2916 1 549 if (@$names)
2926 1 6 if (@$colnames) { }
2931 6 6 $d2 == $dim_values->[1] ? :
2936 1 6 @$rownames ? :
2938 2 44 if ($use_rownames) { }
2964 2 10 if (@dim_values > 2) { }
2974 10 0 if (is_null($r, $l_dimnames)) { }
2979 0 0 defined $l_dimnames ? :
2982 0 10 if (@$dimnames) { }
2987 10 26 $d2 == $dim_values[1] ? :
3009 4 556 if ($is_factor)
3010 1 3 if ($is_ordered) { }
3031 24 884 if ($is_factor) { }
3032 2 22 if (not defined $value) { }
3040 1 883 if (not defined $value) { }
5 878 elsif ($type eq 'complex') { }
291 587 elsif ($type eq 'character') { }
9 578 elsif ($type eq 'logical') { }
3047 4 1 $im >= 0 ? :
3054 4 5 $value ? :
3071 0 11 if (is_null($r, $x1)) { }
11 0 elsif (is_vector($r, $x1) or is_array($r, $x1)) { }
3078 1 10 if ($type eq 'character') { }
1 9 elsif ($type eq 'complex') { }
7 2 elsif ($type eq 'double') { }
1 1 elsif ($type eq 'integer') { }
1 0 elsif ($type eq 'logical') { }
3101 3 8 if (exists $x1->{'dim'}) { }
3106 1 3 if ($d == 1) { }
3113 2 2 if ($x1->{'dim'}->get_length == 1)
3120 7 1 if ($length != 1)
3124 10 1 if (@dim_str)
3131 2 9 $length > 10 ? :
3137 2 9 if ($length > 10)
3154 1312 58 if (@_)
3174 31 24 if ($e1_name eq $name)
3180 0 31 unless $found
3196 0 256 unless (defined $_index)
3203 25 231 if (is_character($r, $x1_index)) { }
3227 1 2 if (is_character($r, $x_index)) { }
3254 1 7 if (is_character($r, $x1_index)) { }
3262 3 5 if (is_null($r, $v1)) { }
3264 2 1 if (exists $x1->{'names'})
3270 2 1 if (exists $x1->{'dimnames'})
3277 1 4 if (is_data_frame($r, $x1))
3280 0 1 if ($x1_length != $v1_length)
3311 1 7 if ($element->{'object_type'} eq 'list') { }
3333 3 13 unless (defined $_col_index)
3342 7 9 if (is_null($r, $col_index)) { }
2 7 elsif (is_character($r, $col_index)) { }
2 5 elsif (is_logical($r, $col_index)) { }
3354 4 2 if $tmp_col_index_values->[$i]
3360 1 4 if ($col_index_values_tmp->[0] < 0) { }
3363 0 2 if $index > 0
3369 1 2 unless $delete_col_index_values_h->{$index}
3386 27 8 unless is_null($r, $row_index)
3421 1 1 if is_factor($r, $x)
3446 6 3 defined $x_func ? :
3468 1 8 if ($func eq '+') { }
4 4 elsif ($func eq '-') { }
1 3 elsif ($func eq '*') { }
1 2 elsif ($func eq '/') { }
1 1 elsif ($func eq '**') { }
1 0 elsif ($func eq '%') { }
3505 2 4 defined $x_min ? :
3506 2 4 defined $x_max ? :
3507 0 6 if $min > $max
3512 2 4 if (defined $r->{'seed'})
3530 1 9 ref $func_name ? :
3565 6 4 if ($x2->{'dim'}->get_length == 1)
3577 0 3 ref $func_name ? :
3586 1 5 if (get_length($r, $x) < $max_length)
3599 1 2 if (@$new_xs == 1) { }
3611 0 1 ref $func_name ? :
3646 0 2 ref $func_name ? :
3673 1 564 if ($x1->{'object_type'} eq 'NULL') { }
560 4 elsif ($x1->{'object_type'} eq 'array' or $x1->{'object_type'} eq 'factor') { }
3 1 elsif ($x1->{'object_type'} eq 'list') { }
1 0 elsif ($x1->{'object_type'} eq 'data.frame') { }
3694 998 19 if ($x1->{'object_type'} eq 'array' or $x1->{'object_type'} eq 'factor') { }
3 16 elsif ($x1->{'object_type'} eq 'list') { }
16 0 elsif ($x1->{'object_type'} eq 'data.frame') { }
3711 0 240 if ($x1->{'object_type'} eq 'array') { }
141 99 elsif ($x1->{'object_type'} eq 'list') { }
99 0 elsif ($x1->{'object_type'} eq 'data.frame') { }
3746 50 0 ref $at eq 'ARRAY' ? :
3751 1 49 if (is_factor($r, $x1)) { }
3753 0 1 unless is_character($r, $x2)
3759 0 2 if (is_na($r, $element)) { }
3764 2 0 if ($levels_h->{$value}) { }
3777 1 48 if ($x1->get_type ne $x2->get_type) { }
3812 1 85 defined $x_decreasing ? :
3817 0 1 $a == $b ? :
2 1 $a > $b ? :
3818 0 314 $a == $b ? :
48 314 $a > $b ? :
1 85 $decreasing ? :
3830 1838 33887 if (@_) { }
3831 118 1720 if (@$dim_values == 1) { }
807 913 elsif (@$dim_values == 2) { }
3846 35725 0 defined $e1 ? :