Skip to contents

Plot line chart

Usage

line_chart(
  data,
  x_var,
  y_var,
  group_var,
  y_axis = NULL,
  x_axis = NULL,
  col = NULL,
  main = NULL,
  ...
)

Arguments

data

The input data frame.

x_var

The variable for the x-axis.

y_var

The variable for the y-axis.

group_var

The variable used to group the data for multiple lines.

y_axis

Optional. The custom Y-axis tick values. If not provided, the function generates them.

x_axis

Optional. The custom X-axis tick values. If not provided, the function generates them.

col

Optional. The colors for the lines. If not provided, the function uses default colors.

main

Optional. The title of the plot.

...

Other parameters.

Value

Line plot.

Examples

library(canregtools)
file <- system.file("extdata", "411721.xls", package = "canregtools")
data <- read_canreg(file)
#> 2200  cases were read from FB sheet.1470  cases were read from SW sheet.
fbsw <- count_canreg(data)
#> [1] "Processing data: 2200 FBcases."
#> [1] "Processing data: 1470 SWcases."
#> [1] "Processing POP data of year: 2016"
age <- create_age_rate(fbsw, sex)
line_chart(age, agegrp, rate, sex)