Error when customizing dates (years) on the x-axis in R using scales_x_date

brakes takes a vector of specific points not a character string , I think you want to use date_breaks instead. See the documentation.

date_breaks A string giving the distance between breaks like "2 weeks", or "10 years". If both breaks and date_breaks are specified, date_breaks wins.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.