MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / na_omit_impl

Function na_omit_impl

inst/include/Rcpp/sugar/functions/na_omit.h:29–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28 template <int RTYPE, bool NA, typename T>
29 Vector<RTYPE> na_omit_impl(const T& x, Rcpp::traits::false_type ) {
30 R_xlen_t n = x.size() ;
31 R_xlen_t n_out = n - sum( is_na(x) ) ;
32
33 if( n_out == n ) return x ;
34
35 Vector<RTYPE> out = no_init(n_out) ;
36 for( R_xlen_t i=0, j=0; i<n; i++){
37 if( Vector<RTYPE>::is_na( x[i] ) ) continue ;
38 out[j++] = x[i];
39 }
40 return out ;
41 }
42
43 template <int RTYPE, bool NA, typename T>
44 Vector<RTYPE> na_omit_impl(const T& x, Rcpp::traits::true_type ) {

Callers

nothing calls this directly

Calls 5

no_initFunction · 0.85
attrMethod · 0.80
sumFunction · 0.70
is_naFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected