Search a data.table for a pattern 'from' and replace it with 'to'.
1 2 | change_in_dt(dat, columns = NA, from, to, stop_missing = TRUE,
change_in_dat = FALSE)
|
dat |
Data.table or data.frame. |
columns |
Columns of data.table/data.frame to search and replace values in. Defaults to NA, which equals all columns. |
from |
Single string that represents pattern to be replaced. Also accepts regular expressions. |
to |
Single string that 'from' is changed into. |
stop_missing |
Logical. Whether to stop when one of your numerical column entries is not found in 'dat'. Defaults to TRUE to avoid errors. In case of FALSE, the function will change all values in the columns that were found |
change_in_dat |
Logical. Whether to change 'dat' directly, without returning it. Defaults to FALSE and thus returns a data.table with the desired changes without changing the input 'dat' directly. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.