Skip to content

Commit

Permalink
live coding sources
Browse files Browse the repository at this point in the history
  • Loading branch information
palday committed Sep 10, 2024
1 parent 53c2efd commit 2e763ca
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions live_coding_sessions/bootstrap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
form = @formula(rt_trunc ~ 1 + spkr * prec * load +
(1 + spkr * prec * load | subj) +
(1 + spkr * prec * load | item))
yolo = fit(MixedModel, form, kb07; contrasts, progress)
48 changes: 48 additions & 0 deletions live_coding_sessions/intro_to_julia.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Statistics

v = [1, 2, 3]
for i in v
println(i)
end

using DataFrames
df = DataFrame(;a=[1,2],b=["a","b"])
describe(df)

select(df, :a)
select(df, "a")

select(df, a)
a = "b"
# select(df, a)
transform(df, :a => ByRow(abs2) => :c)
transform(df, :a => ByRow(abs2) => :a)
transform(df, :a => ByRow(abs2); renamecols=false)

combine(groupby(df, :b), :a => mean; renamecols=false)

# column access
df.a

df[2, :]

df[:, :a]

# mutating variants
transform(df, :a => ByRow(abs2) => :c)
# this adds in the column to the original frame
transform!(df, :a => ByRow(abs2) => :c)

function square(x)
return x^2
end

square(x) = x^2 # like lambda in python

function factor_name(x::AbstractString)
return x
end

function factor_name(x)
return string(x)
end

0 comments on commit 2e763ca

Please sign in to comment.