R: Exploring Data in R

How to Manipulate the variables(Columns)

Helper functions: There are several helper functions that can be used to select columns based on patterns. Some common ones include:

  • starts_with("prefix"): Select columns that start with a specified prefix.
  • ends_with("suffix"): Select columns that end with a specified suffix.
  • contains("pattern"): Select columns that contain a specified pattern.
  • matches("regex"): Select columns that match a regular expression.

Rename a Column in R

  • rename() changes the names of individual variables using new_name = old_name
  • Syntax; rename(data, new_name = old_ragged_name)

Two ways to rename columns

Example 1

Leave a Comment

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

Scroll to Top