I have a dataframe that looks something like this.

```
df <- tibble::tribble(
  ~name,           ~x,  ~y,              ~z,  
  "N/A",           1,   "N/A",           -100, 
  "N A",           3,   "NOt available", -99,
  "N / A",         NA,  "29",              -98,
  "Not Available", -99, "25",              -101,
  "John Smith",    -98, "28",              -1)

```

I would like to use map() and or data.table() to replace all the observations in character variables that are "N/A" or "N A" into `NA`.

I have tried the following but it does not seem to work:

```
chvar <- keep(df,is.character)%>%names()
rpl.NA<- as_mapper(~setDT(df)[.x%in%c("N/A","N A"),.x:=NA])
wrong <- map(chvar,rpl.NA)

```

The issue with this approach is that it produces a list with multiple dataframes in it, rather than simply returning a dataframe.
I have also tried

```
wrong2<-df%>%mutate_at(chvar, list(~replace(., "N/A", NA)))

```

but also this produces an error.

I know that I can do this with `library(naniar)` using the following function

```
na_strings <- c("N/A","N A")
df <- dt %>% replace_with_na_at(.vars = chvar,
                                condition = ~.x %in% na_strings)

```

But this function is very slow and I have to apply it to a large dataset.

Does anyone knows a fast and convenient approach that allows me to apply a function to a selected number of variables on a selected number of observations?

Thanks a lot for your help

Best Regards