Julia


julia

julia-programming.

No, to replace a figure, whether created by scatter() or by plot(), you must use a function with an “!”. Otherwise, the scatterplot points are no longer part of the same.figur

Sequence in Julia

I had been confused by sequence function in r, python, and julia for several times.

Sequence generation in R, Python and Julia provides very good comparison.

Dataframe

# Putting all of this data together in a nice dataset
NFL2018games = DataFrame()
NFL2018games[:Home] = [team1 for (team1, _) in games]
NFL2018games[:Away] = [team2 for (_, team2) in games];

Set operation

https://en.wikibooks.org/wiki/Introducing_Julia/Dictionaries_and_sets

Catesian products

This is provided in the IterTools module (which replaces Iterators module).

Taken from https://github.com/JuliaCollections/IterTools.jl

Iterate over all combinations in the cartesian product of the inputs.

Example:

using IterTools
for p in product(1:3,1:2)
    @show p
end

p = (1,1)
p = (2,1)
p = (3,1)
p = (1,2)
p = (2,2)
p = (3,2)

Possible use:

teams = ["Eagles", "Vikings", "Saints", "Rams", "Cowboys", "Lions", "Panthers", "Seahawks", "Redskins", "Packers",
    "Falcons", "Cardinals", "Giants", "Bears", "Buccaneers", "49ers", "Patriots", "Steelers", "Jaguars", "Chiefs",
    "Bills", "Ravens", "Titans", "Chargers", "Dolphins", "Bengals", "Colts", "Raiders", "Jets", "Browns", "Texans", 
    "Broncos"]
    
 games = [ p for p in product(teams,teams) if p[1]!=p[2]]