I want to filter the data frame on multiple conditions and assign values if these conditions are true,
I have written the following code, but I get the following error ERROR: MethodError: convert(::Type{Union{}}, ::String) is ambiguous.
#Make a new column c2 with missing values
df[:,:c2] .= missing
#Filter and assign values to column c2
df[(.!ismissing.(df.preconV) .& .!ismissing.(df.delayV) .& ismissing.(df.budgetV) .& .!ismissing.(df.improvDeclV)), :c2 ] .= "A1"
However, when I take out the .= "A1" part the data frame gets filtered properly. Its just when its assigning value the error pops in.
#Just filtering works fine!
df[(.!ismissing.(df.preconV) .& .!ismissing.(df.delayV) .& ismissing.(df.budgetV) .& .!ismissing.(df.improvDeclV)), :c2 ]
#out > 65-element Array{Missing, 1}
I am also aware that its possible to use ifelse command to achieve the same results, but in this case, it won't work, since this is just one line of code I have shown here, but I have many other lines of code, for other combinations (preconV, delayV...) and else statement will overwrite values from the previous statement.
I have attached a pic of part of the dataframe to get an idea (only 4 columns are displayed since the dataframe is just too big)
Any ideas what's causing the ambiguous error?
