I am trying to move from R to Julia.
So I have a dataset with 2 columns of prices and 2 conditional columns telling me if the price is "cheap" or "expensive".
So I want to count how many "cheap" or "expensive" entries are.
So using the package DataStructures
I got this:
using DataStructures
counter(df.p_orellana)
Accumulator{Union{Missing, String}, Int64} with 3 entries:
"expensive" => 18
missing => 2
"cheap" => 22
This would be the same as the table()
function in R.
Is there any way to make these values proportions?
In R it would be to prop.Table()
function, but I am not sure how to do it with Julia.
I would like to have:
Accumulator{Union{Missing, String}, Int64} with 3 entries:
"expensive" => 0.4285
missing => 0.0476
"cheap" => 0.5238
Thanks in advance!
Use the FreqTables.jl package.
Here is an example:
The results are shown in sorted order. If you would like other order use the CategoricalArrays.jl package additionally and set an appropriate ordering of levels: