I think you can replace ""
and 9999
by NA
values before plotting. There is several ways to do that depending on the tools you want to use.
naniar
has really good tools for dealing with missing values. Among theme, you'll find naniar::replace_with_na
that will do the job.
You can also recode your column (with dplyr
's recode
, if_else
or case_when
) to replace the values.
As you deal with factor, you may need more factors oriented tools. There are dplyr::recode_factor
or even forcats::fct_recode
where you can remove levels easily. forcats
is the toolbox for factors in the tidyverse.
Indeed, you can also do it with base R too. At the end, it is as you like.
If you manage to provide a reprex, we can be sure it is the issue and we can work on an example for you.
rem: I also edited your post for formatting purposes