Assignment of a `missing` value fails in DataFrames 0.11.1

Well, in R you always create new columns, so it’s not completely unreasonable. You’d just do something like this:

df[:x] = ifelse.(df[:x] .< 0, missing, df[:x])

or if you want to hardcode the list of missing levels for safety:

using CategoricalArrays
df[:x] = recode(df[:x], -1 => missing, -2 => missing)

Of course, higher-level frameworks like Query or DataFramesMeta will allow you to do this with a nicer syntax.

EDIT: The recode solution currently does not work, as the returned array is allowed to contain only missing values. That could be improved. See Add special case for single missing RHS in recode() by nalimilan · Pull Request #103 · JuliaData/CategoricalArrays.jl · GitHub.