dplyr::mutate

  • mutate() is a part of the dplyr package
  • This is useful for data manipulation
  • Mutate creates a new variable(column) or modify existing ones

Syntax:

  • .data: This is the data frame or tibble that you want to modify.
  • ...: This ellipsis (...) is a way of allowing additional arguments to be passed to the function
  • .by: This parameter allows you to specify a grouping variable.
  • .keep: This parameter determines which variables are retained in the output.
  • .before and .after: Used to specify the order of columns.

Example,

R: Transmute

  • Transform a data frame and return only the newly created variables
  • It has the same parameters as mutate()

Syntax

eXAMPLE: mutate()

Example 2:

Example transmute(): used this to create new variables and drop the othres

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top