Access columns by variable name with `readdlm` from `DelimitedFiles`

Once again, the documentation of Julia is useless and provides no help. I read a .txt file with the command data=readdlm("data.txt", header=true) from the DelimitedFiles package. The result is a Tuple with the data separated from the headers. I want to call a certain column of the data object using the header name, just as R does data$variable. I tried data[:"variable"] and data[:variable] but with no success. How are we able to know how to treat the header=true option if there is no help on Julia documentation about that? I think a lot has to be done concerning the help pages in Julia. The other languages have more helpful documentation concerning their commands.

You’ll want to use a package like CSV.jl or CSVFiles.jl and read your data into a DataFrame for that kind of feature.

Once again, the documentation of Julia is useless and provides no help.

So be the person that improves the documentation by opening a pull request with text that is better than what we have right now! Everything in julia land is done by volunteers, and helping improve the documentation is a great way to become a member of the community and giving back to all the folks that volunteered their time for free to create the functionality in the first place :slight_smile:

2 Likes

Yes I know and I agree with you :wink: Concerning your answer, is the DataFrame format the unique way to do that? Is it not possible to work with the Array format? So, what’s the point of providing a header=true option with the readdlm command if there is no use for that?

No, there are many other tabular packages besides DataFrame, but DataFrame is by far the most popular and probably should be your starting point.

So, what’s the point of providing a header=true option with the readdlm command if there is no use for that

There are lots of uses for it, but for your specific case other packages are a better choice.

2 Likes

Ok thanks :wink: