Ive got some scientific data that ive imported form a CSV to R
unfortuanly I have values that are "<LOD" like in the code below I need to change them to NA so that the coumbs can be numeric and I can start calculating averages etc.
i know mutate and
tb<-tibble(
Mg=c(1,2,4,5,"<LOD"),
Hg=c(5,10,15,"<LOD",11),
Fe=c(15,"<LOD",10,4,23)
)
I know something like this would work but I have 100 variables and I need to do this for all of them. Does anyone have any idea how I can apply it to all my columns quickly I tried Mutate_all but Str_replace needs the string to be defined.
tb%>%mutate(Mg=str_replace(Mg,string="<LOD", replacement = NA_character_))
thanks