I'm trying to create for loop based on external vector and my expectation is to create aa_loop which is prefiltered based on uni input (for test only). Why below code doesn't produce aa_loop or how to do it in a proper way?
names = ["Sally", "Bob", "Alice", "Hank"]
grades = [1, 5, 8.5, 4]
aaa = DataFrame(name=names, grades=grades)
#for test only
uni = "Bob"
for nm in uni
aa_loop = subset(aaa, :name => ByRow(==(nm)))
end
Iterating over a string produces characters, so
for nm in uniwill produce'B', then'o'and then'b'. Try puttinguniin a container, likefor nm in (uni,)orfor nm in [uni]