-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
At first, we should make the package work for simple random samples and then extend the functionality to other design types. The current design of the package doesn't allow development to be done in that way.
How about:
abstract type SurveyDesign end
struct SimpleRandomSample <: SurveyDesign
data::DataFrame
end
struct StratifiedSample <: SurveyDesign
data::DataFrame
end
function plot(x::SurveyDesign)
plot(x.data)
# works on any child of SurveyDesign
end
function mean(variable, x::SimpleRandomSample)
# computes the mean of a variable from a simple random sample
endLater, we can add:
function mean(variable, x::StratifiedSample)
# computes the mean of a variable from a stratified sample.
endThere is pristine clarity on which functions work on which design types.
If we want to keep the API similar to R, we should consider wrappers.
Metadata
Metadata
Assignees
Labels
No labels