Skip to content

Commit 028195f

Browse files
Update README.md
1 parent 44f4919 commit 028195f

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,49 @@ The following table provides an overview of the data that can be accessed in thi
4343
<br />
4444

4545

46+
## How to access and download data files
47+
48+
49+
### Download directly from GitHub
50+
51+
1. Click on the following link to access the raw version of the data file:
52+
<a href="https://github.com/analyticsinmotion/julia-packages-data/blob/main/data/julia_package_names.csv" target="_blank">julia_package_names.csv</a>
53+
54+
2. Click the "Download" button located at the top right of the screen to download the raw data file (julia_package_names.csv) to your local machine. If prompted, choose a location to save the file.
55+
56+
### Using Julia to access data
57+
58+
1. Install the required packages:
59+
60+
```julia
61+
using Pkg; Pkg.add(["HTTP", "CSV", "DataFrames"])
62+
```
63+
64+
2. Import the Required Modules:
65+
```julia
66+
using HTTP, CSV, DataFrames
67+
```
68+
69+
3. Create a helper function:
70+
```julia
71+
function get_julia_master_file(return_dataframe::Bool=true, download_csv::Bool=false)
72+
url = "https://raw.githubusercontent.com/analyticsinmotion/julia-packages-data/main/data/julia_package_names.csv"
73+
response = HTTP.get(url)
74+
response.status == 200 || error("Failed to retrieve data from the URL")
75+
df_julia_package_names = IOBuffer(response.body) |> CSV.File |> DataFrame
76+
download_csv ? CSV.write("julia_package_names.csv", df_julia_package_names) : nothing
77+
return return_dataframe ? df_julia_package_names : nothing
78+
end
79+
```
80+
81+
4. Call the helper function:
82+
```julia
83+
# Variable values of true, true will return the DataFrame within Julia and also export it as a CSV file
84+
get_julia_master_file(true, true)
85+
```
86+
87+
<br /><br />
88+
4689
<!-- DATA DICTIONARY -->
4790
## Data Dictionary
4891

0 commit comments

Comments
 (0)