dollar_to_double_bracket: Switch '.data$colname' to '.data[["col_name"]]'

View source: R/dollar_to_double_bracket.r

dollar_to_double_bracketR Documentation

Switch .data$colname to .data[["col_name"]]

Description

When creating a package the preferred extraction operator is .data[["col_name"]]. What to do if you have the form .data$col_name littered throughout your package? Can you be bothered finding and correcting them all?

Usage

dollar_to_double_bracket(
  files = list.files(path = ".", pattern = ".R$", recursive = TRUE, full.names = TRUE)
)

Arguments

files

(character vector) Full path to the files to be changed

Details

This function will modify files in your package. It is strongly recommended to save a copy of your files or use git before diving in and using this function.

Value

Nothing, called for side effect

Examples

## Not run: 
dollar_to_double_bracket(files = "./R/get_data.R")

## End(Not run)

baslat/sak documentation built on April 14, 2025, 4:14 p.m.