How can one pass the name of a table column to a function and access this column in the function? For example, if we define
using TypedTables
t = Table(time = [1,2,3], valueA = [10, 20, 30])
then I can simply access columns as follows
t.time
where I explicitly spell out the column name. However, what I want to do is pass the table and some column names to a function and access them within the function, the table columns
function fn(cnames::Array{String,1}, t::Table)
for c in cnames
#get column c from table t
#do something with column c
end
end
I don't know what to do in the for-loop. Simply putting
t.c
or
t.Symbol(c)
doesn't work.