juliajuliadb

JuliaDB select a column from a string, not a symbol


I want to select a column from a JuliDB database. The problem is that I can't do it with string (not a symbol that starts with :), for example:

db = loadtable("table.dat")
#This table has 3 columns named  position_1, position2, position_3
pos_num = 3
column_name = "position_$pos_num"
select(db,column_name)

If I do that, then the following error appears:

column position_3 not found.

Any suggestion?


Solution

  • You can create a symbol directly Symbol("position_$pos_num") or from your string with Symbol(column_name).