Finding the id of all columns containing 1 for a particular row of a DataFrame

I have a DataFrame consisting of many columns and rows, and each entry being simply 1’s or 0’s. For a particular row, I now want to identify all the columns that contain 1. So, I do the following for the first row:

findall(x->x == 1,data[1,:]))

The result is a Vector(Symbol) containing :x5, :x22, and :x79.

Since my purpose is to use the ids (i.e., the 5, the 22, and the 79) to get information from a related Array, I could do the following instead

ids = findall(x->x == 1,convert(Array,data[1,:]))

So my question is, can I achieve the same effect without “convert”?

Here is one way of doing it

julia> df = DataFrame(a = [1, 1], b = [0, 0], c = [0, 1]);

julia> names_dict = Dict(propertynames(df)[i] => i for i in 1:length(propertynames(df)))
Dict{Symbol, Int64} with 3 entries:
  :a => 1
  :b => 2
  :c => 3

julia> df.has_1 = map(eachrow(df)) do row
           getindex.(Ref(names_dict), findall(==(1), row))
       end
2-element Vector{Vector{Int64}}:
 [1]
 [1, 3]
using DataFrames

data = DataFrame(rand(0:1,4,4))
│ Row │ x1    │ x2    │ x3    │ x4    │
│     │ Int64 │ Int64 │ Int64 │ Int64 │
├─────┼───────┼───────┼───────┼───────┤
│ 1   │ 1     │ 1     │ 1     │ 0     │
│ 2   │ 0     │ 1     │ 1     │ 0     │
│ 3   │ 0     │ 1     │ 1     │ 0     │
│ 4   │ 0     │ 1     │ 0     │ 0     │

(1:size(data,2))[[d==1 for d in data[1,:]]]
3-element Vector{Int64}:
 1
 2
 3
(1:size(data,2))[[d==1 for d in data[2,:]]]
2-element Vector{Int64}:
 2
 3