The n() provides the number of values in a vector, where as n_distinct() provides number of distinct values in a vector. For example, if we take the sample “flights” dataset in R, then we see the following characteristic: We first remove the NA values from air_time and distance before using the summarise function. The n() function performs a count of total number of flights or rows in the dataset. The n_distinct() function captures the number of distinct carriers / airlines in the dataset which is 16.