I have a dataset (read in from a CSV). I’m trying to count how many observations contain a substring (for simplicity, let’s call it “X”). In R, I can do this
sum(stringr::str_count(data$CITY, "X")) > 0
I’m having trouble figuring out what the analagous Julia code would be. I’ve tried
sum(contains.(data[:CITY], "X")) > 0
But the LHS gives me a
Nullable array that can’t be compared with
0. I can force
0 to be Nullable (e.g.
Nullable(0), but then I can’t use this comparison in an
if statement e.g.
if sum(contains.(data[:CITY], "X")) > Nullable(0) # do some stuff end
Any thoughts on the appropriate way to make this count and compare to another number?