Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
fix(08_ordinal_reg): use DataFrames.transform! (#86)
Browse files Browse the repository at this point in the history
This is because of `Bijectors.transform!`
  • Loading branch information
storopoli authored Oct 30, 2023
1 parent 9f24cb5 commit 86bc11f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions _literate/08_ordinal_reg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ using CairoMakie
using AlgebraOfGraphics
using Distributions
using StatsFuns: logit
using DataFrames: transform!

# Here we have a discrete variable `x` with 6 possible ordered values as response.
# The values range from 1 to 6 having probability, respectively:
Expand Down Expand Up @@ -344,7 +343,7 @@ esoph = CSV.read(HTTP.get(url).body, DataFrame)

using CategoricalArrays

transform!(
DataFrames.transform!(
esoph,
:agegp =>
x -> categorical(
Expand All @@ -356,7 +355,7 @@ transform!(
x -> categorical(x; levels=["0-9g/day", "10-19", "20-29", "30+"], ordered=true);
renamecols=false,
)
transform!(esoph, [:agegp, :alcgp, :tobgp] .=> ByRow(levelcode); renamecols=false)
DataFrames.transform!(esoph, [:agegp, :alcgp, :tobgp] .=> ByRow(levelcode); renamecols=false)

X = Matrix(select(esoph, [:agegp, :alcgp]))
y = esoph[:, :tobgp]
Expand Down

0 comments on commit 86bc11f

Please sign in to comment.