Question: I am using Indirect file load in Informatica where source file can be one or multiple .csv files.

Source file name format is: production\_plan\_YYYYMMDD.csv

Target table has a column named production\_date, I need to write a pre sql command which will delete all records where production\_date will be matched with the date mentioned (YYYYMMDD)currently processed file name.

I can add currently processed file name port in Source but not sure if I can use this information in presql to delete records as per my logic

Answer: 
`rename` works for me, perhaps you have a function conflict with another package. Try using `dplyr::rename`.

To change the columns based on range of values you may use `case_when` or `cut`.

```
library(dplyr)

Auto.df %>%
  dplyr::rename(mpgclass = mpg) %>%
  mutate(mpg = case_when(mpgclass < 20 ~'low', 
                         between(mpgclass, 20, 27) ~ 'medium', 
                         TRUE ~ 'high'), 
         mpg2 = cut(mpgclass, c(-Inf, 20, 27, Inf), c('low', 'medium', 'high')))

```
You may use `cut()`.

```
library(dplyr)

new <- mtcars %>%
  mutate(mpg_c=cut(mpg, c(0, 16, 22, Inf), labels=c('low', 'medium', 'hi')))

tail(new)
#                 mpg cyl disp  hp drat    wt  qsec vs am gear carb  mpg_c
# Porsche 914-2  26.0   4 120.3  91 4.43 2.140 16.7  0  1    5    2     hi
# Lotus Europa   30.4   4  95.1 113 3.77 1.513 16.9  1  1    5    2     hi
# Ford Pantera L 15.8   8 351.0 264 4.22 3.170 14.5  0  1    5    4    low
# Ferrari Dino   19.7   6 145.0 175 3.62 2.770 15.5  0  1    5    6 medium
# Maserati Bora  15.0   8 301.0 335 3.54 3.570 14.6  0  1    5    8    low
# Volvo 142E     21.4   4 121.0 109 4.11 2.780 18.6  1  1    4    2 medium

```

**Base R:**

```
mtcars |>
  transform(mpg_c=cut(mpg, c(0, 16, 22, Inf), labels=c('low', 'medium', 'hi')))

```