concept NaN in category R

appears as: NaN
Exploring Data with R

This is an excerpt from Manning's book Exploring Data with R.

Now we see that all values in the avg_mass column are non-NA, however, there is now at least one NaN (not a number) value:

#> # A tibble: 38 x 2
#>    species   avg_mass
#>    <chr>        <dbl>
#>  1 Aleena        15 
#>  2 Besalisk     102 
#>  3 Cerean        82 
#>  4 Chagrian     NaN 
#>  5 Clawdite      55 
#>  6 Droid         69.8
#>  7 Dug           40 
#>  8 Ewok          20 
#>  9 Geonosian     80 
#> 10 Gungan        74 
#> # … with 28 more rows

This is explainable. The cause of this stems from there not being any non-NA values for that species. The consequence is that a mean couldn’t be calculated, so R returned an NaN.