# create multiple sparklines
sparklines <- c(
create_sparklines("Sheet 1", "A3:L3", "M3", type = "column", first = "1"),
create_sparklines("Sheet 1", "A2:L2", "M2", markers = "1"),
create_sparklines("Sheet 1", "A4:L4", "M4", type = "stacked", negative = "1"),
create_sparklines("Sheet 1", "A5:L5;A7:L7", "M5;M7", markers = "1")
)
t1 <- AirPassengers
t2 <- do.call(cbind, split(t1, cycle(t1)))
dimnames(t2) <- dimnames(.preformat.ts(t1))
wb <- wb_workbook()$
add_worksheet("Sheet 1")$
add_data(x = t2)$
add_sparklines(sparklines = sparklines)
# create sparkline groups
sparklines <- c(
create_sparklines("Sheet 2", "A2:L6;", "M2:M6", markers = "1"),
create_sparklines(
"Sheet 2", "A7:L7;A9:L9", "M7;M9", type = "stacked", negative = "1"
),
create_sparklines(
"Sheet 2", "A8:L8;A10:L13", "M8;M10:M13",
type = "column", first = "1"
),
create_sparklines(
"Sheet 2", "A2:L13", "A14:L14", type = "column", first = "1",
direction = "col"
)
)
wb <- wb$
add_worksheet("Sheet 2")$
add_data(x = t2)$
add_sparklines(sparklines = sparklines)
Run the code above in your browser using DataLab