We wish to get the number of rows and / or the number of columns of a data frame.
We wish to obtain both the number of rows and number of columns of a data frame.
df %>% dim()
Here is how this works:
df
to the function dim()
.dim()
returns a two element vector where the first element is the number of rows of the data frame and the second element is the number of columns.We wish to obtain the number of rows of a data frame.
df %>% nrow()
Here is how this works:
df
to the function dim()
.nrow()
returns the number of rows of the data frame (as an integer).We wish to obtain the number of columns of a data frame..
df %>% ncol()
Here is how this works:
df
to the function dim()
.ncol()
returns the number of columns of the data frame (as an integer).