Skip to content

Create bivariate graph function #15

@scheidec

Description

@scheidec

Proposed syntax:

bivariate_plot(tbl, x, y, xlab, xylab)

where:

  • tbl is the dataframe containing x and y
  • x is the independent variable (bivariate only)
  • y is the dependent variable
  • xlab is the x-axis label which defaults to the label metadata but uses the variable name if empty
  • ylab is the y-axis label which defaults to the label metadata but uses the variable name if empty

Outputs:

  • If both x and y are continuous --> Scatterplot and loess fit
  • If x is categorical and y is continuous --> Boxplot
  • If both x and y are categorical --> Grouped bar graph where y-axis is labeled as "Within Group Percent (%)" and bars are labelled with counts
  • If x is continuous and y is categorical --> Grouped bar graph where y-axis is labeled as "Within Group Percent (%)" and bars are labelled with counts. If number of x values > 15, then convert to deciles first.

Other features should include:

  • If x is a vector, then the plot should facet_grid or facet_wrap by x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions