Skip to contents

This function plots the distribution of two parameters in a scatterplot.

Usage

vis_2_params(
  df,
  param_1,
  param_2,
  slope = NULL,
  intercept = 0,
  check = NULL,
  fit = NULL
)

Arguments

df

a dataframe.

param_1

character. Name of variable of the dataframe to be plotted on the x-axis.

param_2

character. Name of variable of the dataframe to be plotted on the y-axis.

slope

numeric. Default is NULL. If different than 0, plots a linear line with a user-defined intercept and the defined slope.

intercept

numeric. Default is 0. Intercept of the user-defined slope.

check

character. Default is NULL. When set to "param_2 > param_1", plots dot fulfilling the condition in red.

fit

character. Designate the type of smooth model to fit to the relation of `param_1` (x) and `param_2` (y). It can take the values "lm, "glm", "gam", and "loess". A model will be fitted according to the methods described in ggplot2::geom_smooth().

Value

A ggplot graph.

Examples

# Generating plot using the example dataframe for the costs of progression-free health state, and bins of 50 euros.
data(df_pa)
vis_1_param(df = df_pa, param = "c_pfs", binwidth = 50)
#> Error in computing default starting values.
#> Error in manageparam(start.arg = start, fix.arg = fix.arg, obs = data,     distname = distname): Error in startargdefault(obs, distname) : 
#>   values must be in [0-1] to fit a beta distribution