Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update show #175

Merged
merged 6 commits into from
Jan 13, 2023
Merged

Update show #175

merged 6 commits into from
Jan 13, 2023

Conversation

iuliadmtru
Copy link
Contributor

After reverting and re-reverting mistakes, I can finally start a draft PR.

I started working on show. After considering a lot of options, this is the one that I think looks nicest and is in line with Julia standards:

(I just changed my mind and now I think the vectors for popsize, sampsize, weights and probs should be on the same line as the names:

popsize: [6190.0, 6190.0, 6190.0  …  6190.0]

instead of

popsize:
    [6190.0, 6190.0, 6190.0  …  6190.0]

but I will add this later)

Stratified:

julia> apistrat = load_data("apistrat");

julia> strat = SurveyDesign(apistrat; strata=:stype, weights=:pw)
SurveyDesign:
data: 200×46 DataFrame
strata: stype
    [E, E, E    H]
cluster: none
popsize:
    [6190.0, 6190.0, 6190.0    6190.0]
sampsize:
    [200, 200, 200    200]
weights:
    [44.2, 44.2, 44.2    15.1]
probs:
    [0.0226, 0.0226, 0.0226    0.0662]

Clustered:

julia> apiclus1 = load_data("apiclus1");

julia> clus_one_stage = SurveyDesign(apiclus1; clusters=:dnum, weights=:pw)
SurveyDesign:
data: 183×46 DataFrame
strata: none
cluster: dnum
    [637, 637, 637    448]
popsize:
    [6190.0, 6190.0, 6190.0    6190.0]
sampsize:
    [15, 15, 15    15]
weights:
    [33.8, 33.8, 33.8    33.8]
probs:
    [0.0295, 0.0295, 0.0295    0.0295]

Replicate:

julia> bstrat = strat |> bootweights
ReplicateDesign:
data: 200×4046 DataFrame
strata: stype
    [E, E, E    H]
cluster: none
popsize:
    [6190.0, 6190.0, 6190.0    6190.0]
sampsize:
    [200, 200, 200    200]
weights:
    [44.2, 44.2, 44.2    15.1]
probs:
    [0.0226, 0.0226, 0.0226    0.0662]
replicates: 4000

There are a few things that I think we should discuss:

  • Should we mention the length of the vectors somewhere?

    Cons:

    • It will cause clutter.
    • It will always be the same as the number of rows in the data frame.

    Pro:

    • It seems to be the Julia standard to mention the summary of a data structure
  • Should we keep our own pretty-printing or should we just rely on IOContext's :limit=>true, :compact=>true?

    • I defined survey(io) which is an IOContext for pretty printing (it sets :limit, :compact and :displaysize) but I couldn't get it to work properly. The display size just wasn't changing. So I went back to using makeshort, which I modified to add square brackets around vectors and use instead of ....

@codecov-commenter
Copy link

Codecov Report

Merging #175 (16b0444) into singledesign (15e34ec) will increase coverage by 7.36%.
The diff coverage is 0.00%.

@@               Coverage Diff                @@
##           singledesign     #175      +/-   ##
================================================
+ Coverage         64.79%   72.15%   +7.36%     
================================================
  Files                13       13              
  Lines               196      176      -20     
================================================
  Hits                127      127              
+ Misses               69       49      -20     
Impacted Files Coverage Δ
src/show.jl 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@iuliadmtru
Copy link
Contributor Author

This partially solves #173.

@iuliadmtru iuliadmtru marked this pull request as ready for review January 12, 2023 09:27
@iuliadmtru iuliadmtru mentioned this pull request Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants