Your question is about different columns, but your example is with different objects. I will answer both cases, but first a reproducible example:
set.seed(123)
X <- data.frame(
a = sample(c(0:2, NA, 'N/A'), 4),
b = sample(c(0:2, NA, 'N/A'), 4)
)
X -> Y1 -> Y2
> X
a b
1 1 N/A
2 <NA> 0
3 N/A 1
4 2 2
For all the columns in a data frame:
X[X == 0 | X == 'N/A'] <- NA
# `is.na(x) <- NA` is redundant
> X
a b
1 1 <NA>
2 <NA> <NA>
3 <NA> 1
4 2 2
For multiple data frames
If instead you need to repeat operations in multiple data frames, it's advised to put then in a list:
df.list <- mget(objects(pattern = 'Y'))
> lapply(df.list, function(x) replace(x, x == 0 | x == 'N/A', NA))
$Y1
a b
1 1 <NA>
2 <NA> <NA>
3 <NA> 1
4 2 2
$Y2
a b
1 1 <NA>
2 <NA> <NA>
3 <NA> 1
4 2 2
If you need to convert your list back to single objects, you can use:
list2env(df.list, .GlobalEnv) # this will overwrite objects with same names