My understanding is that in Julia I would need to do:
using DataFrames; using CSV;
df = CSV.File("data.csv") |> DataFrame;
The code in Julia is relatively (very) slow vs R for various reason and I understand some people are looking at improving it, but that is not the topic of my question here. My question is:
is there a way to use CSV.File and DataFrame without loading the whole package (like in R) and not having to run using DataFrames; using CSV;?
I don’t think so: to use definitions from a module you need to load its code and bring it into scope, which you do with using or import (see here for the differences between the two).
I guess the important questions are: what problem do you have with using the package? Why would you want to avoid it?
It is to avoid conflict with functions that have the same name which actually happens in R. In R you have the following:
> dt = data.table::fread("Downloads/dataset.csv")
> dt = fread("Downloads/dataset.csv")
Error in fread("Downloads/dataset.csv") : could not find function "fread"
Meaning fread is not in scope.
But I guess that if I use CSV.File and DataFrames.DataFrame I am making it clear which function from which package I am using.
Thank you for your answers (which I believe answer my question).
If you just do using DataFrames: DataFrames (note that this is the same name as the module - you’re quite literally only bringing the module name into scope, not the exported names), you can do DataFrames.DataFrame(...) to qualify which you mean.