powered by
Returns the number of observations of a vector or data.frame. It uses vctrs::vec_size() under the hood.
vctrs::vec_size()
n_obs(x, names = TRUE)
number of observations
vector or data.frame
logical; If TRUE the result is a named vector named "n_obs", else it is just the number of observations.
n_obs(iris) n_obs(1:10) add_n_obs(heights) heights %>% features(height_cm, n_obs) # can be any variable except id, the key.
Run the code above in your browser using DataLab