Trouble creating new binary variable from existing character variable

I'm trying to create a new variable and keep getting errors. I have dataframe ('x') with a character variable 'y' that has 3 levels ("A", "B", "C"...and some NA's). I want to create a new binary variable 'z' that looks like the below:

ID y z
1 A 1
2 B 0
3 C 0
4 NA 0

I've tried various flavors of:

x$z <- recode(x$y, "'A'=1; 'B'=0; 'C'=0; NA=0")

I keep getting errors such as:

Warning: Unknown or uninitialised column: y.

Error: Assigned data recode(x$y, "'A'=1; 'B'=0; 'C'=0; NA=0") must be compatible with existing data.

x Existing data has 2001 rows.

x Assigned data has 0 rows.

i Only vectors of size 1 are recycled.

I've recoded other variables with no issue, so I'm uncertain why this isn't working. Help!?

Take the double quotes out. Maybe also commas rather than semicolons, although I'm not sure about that.