R expand.grid() Function

R expand.grid() Function

R expand.grid() function from the base package is used to create a data frame from all combinations of the factor levels of the input vectors. Each input vector becomes a column in the data frame, and each row represents a unique combination of elements from these vectors. The expand.grid() function can be combined with other … Read more

R unnest() Function from tidyr

R unnest() Function from tidyr

The tidyr::unnest() function is used to “flatten” or expand a list column in a tibble or data frame.  When you have a column where each element is a list or a tibble (often created by nest() or other list-collecting functions), this function allows you to turn each list element into its row, effectively expanding the … Read more

R crossing() Function from tidyr

R crossing() Function from tidyr

The tidyr::crossing() function is used to create a data frame or tibble that contains all combinations of the input vectors or factors. This function is similar to the expand.grid() function in base R but returns a tibble, a modern take on data frames. Syntax crossing(…) Parameters Name Description … Vectors or factors for which you … Read more

R expand() Function from tidyr

R expand() Function from tidyr

The expand() function in R from the tidyr package, part of the tidyverse suite, is used to create a data frame (or tibble) containing all possible combinations of the unique values of one or more factors or variables in your data. It’s different from crossing() (also in tidyr), which creates direct combinations of vectors you … Read more

R distinct() Function from dplyr

R distinct() Function from dplyr

The dplyr::distinct() function in R is used to remove duplicate rows from a data frame or tibble. Syntax distinct(.data, …, .keep_all = FALSE) Parameters Name Description .data It is a data frame or tibble from which to remove duplicate rows. … Variables to use when determining uniqueness. It will use all variables in the data frame … Read more

R arrange_if() Function from dplyr

R arrange_if() Function from dplyr

The dplyr::arrange_if() function in R is used to arrange (sort) rows of a data frame or tibble based on conditions applied to its columns. This function is the scoped variant of the arrange() function, which also includes arrange_at() and arrange_all(). This function has been superseded by the more flexible across() or pick() function in newer … Read more

R arrange_at() Function from dplyr

R arrange_at() Function from dplyr

The dplyr::arrange_at() function is used for arranging (sorting) a data frame or tibble based on a selection of its columns. This function is part of the scoped variants of the arrange() function, which also includes arrange_if() and arrange_all(). This function has been superseded by the more versatile across() or pick() function. Syntax arrange_at(.tbl, .vars, .funs … Read more

R arrange_all() Function from dplyr

R arrange_all() Function from dplyr

R arrange_all() function from the dplyr package is used for sorting or arranging rows of a data frame or tibble based on all its columns. This function has been superseded by the use of pick() or across() within the standard arrange() verb, but they are still available for use. They can be accommodating in certain … Read more

R mutate_at() Function from dplyr

R mutate_at() Function from dplyr

R dplyr::mutate_at() function is used to transform or create new columns in a data frame or tibble based on specific criteria, applying the same transformation to multiple columns. This function is a part of a family of scoped variants of mutate(), which includes mutate_if(), mutate_at(), and mutate_all(). Syntax mutate_at(.tbl, .vars, .funs, …) Parameters Name Description … Read more

R select_at() Function from dplyr

R select_at() Function from dplyr

The dplyr::select_at() function is used to select columns from a data frame or tibble based on specific conditions. This function is part of the scoped selection family of functions (select_if(), select_all(), select_at()), which allows for a more flexible column selection than the base select() function. These scoped selection functions (select_if(), select_at(), select_all()) have been superseded … Read more