ggimportance: Generate a ggplot2 for rank versus relative importance chart.

Description Usage Arguments Details Value Examples

View source: R/ggimportance.R

Description

The function generates a scatter plot of item rank (y-axis) versus importance (x-axis)

Usage

1
2
3
4
5
6
7
ggimportance(
  x,
  dep_var = "general",
  title = "",
  xlabel = "Relative contribution to dependent variable",
  ylabel = "Mean rank (1-5)"
)

Arguments

x

a tbl() with the data.

dep_var

The name of the dependent variable (use dplyr style without quotes) Usually this would be either general satisfaction or NPS

title

string for ggtitle

xlabel

string for xlab

ylabel

string for ylab

Details

The function uses the 'relaimpo' package to compute item importance (relative to a dependent variable) Then, it plots the item's rank versus computed importance. To compute importance the function uses the 'lmg' measure (see documentation of 'relaimpo::calc.relimp') A linear model (function 'lm') is used for the importance computation. if the model have perfect fit or a bad fit, the function output would be based only on the model coefficients and not on 'relaimpo::calc.relimp'

Value

A ggplot2 as specified above.

Examples

1
2
3
4
5
6
7
8
9
satisfaction <- tribble(
  ~general, ~staff, ~professionalism,
  5, 5, 4,
  3, 2, 3,
  4, 5, 5,
  1, 2, 2,
  3, 3, 4
  )
ggimportance(satisfaction, dep_var = general)

sarid-ins/saridr documentation built on Nov. 10, 2020, 9:07 p.m.