rccShiny2: Shiny apps for RCC

Description Usage Arguments Details Value Author(s) Examples

View source: R/rccShiny2.R

Description

returns shiny apps that can be used as a complement to the annual reports from the cancer quality registries in Sweden.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
rccShiny2(inca = FALSE, incaScript = NULL, incaIncludeList = TRUE,
  folder = "ind", path = getwd(), language = "sv", data = NULL,
  id = NULL, idOverviewLink = NULL, idAuthorisedToView = NULL,
  outcome = "outcome", outcomeNumericExcludeNeg = TRUE,
  outcomeTitle = outcome, textBeforeSubtitle = NULL,
  textAfterSubtitle = NULL, comment = "", description = rep(NA, 3),
  geoUnitsHospital = "sjukhus", geoUnitsHospitalCode = "sjukhuskod",
  geoUnitsHospitalSelected = NULL, geoUnitsCounty = "landsting",
  geoUnitsRegion = "region", geoUnitsPatient = FALSE,
  geoUnitsDefault = "county", regionSelection = TRUE,
  regionSelectionDefault = NULL, regionLabel = NULL,
  period = "period", periodDateLevel = "year", periodLabel = NULL,
  periodDefaultStart = NULL, periodDefaultEnd = NULL,
  varOther = NULL, allLabel = NULL, targetValues = NULL,
  funnelplot = FALSE, sort = TRUE, sortDescending = NULL,
  propWithinShow = TRUE, propWithinUnit = NULL, propWithinValue = 30,
  hideLessThan = 5, gaPath = NULL, npcrGroupPrivateOthers = FALSE,
  outputHighcharts = FALSE)

Arguments

inca

should output be as if on the INCA platform? Default is FALSE.

incaScript

script to be run after loading data on the INCA platform. Default is NULL.

incaIncludeList

Should the tab with list of patients be included if on the INCA platform? Default is TRUE.

folder

name of folder where the results are placed. Default is "ind".

path

search path to folder returned by the function. Default is working directory.

language

vector giving the language for the app. Possible values are "sv" and "en". Default is "sv". See details.

data

data frame containing the variables used when not on the INCA platform.

id

optional name of variable in data containing the id of each individual. This is displayed in the list tab if on the INCA platform. Default is NULL.

idOverviewLink

optional name of variable in data containing the HTML link to the patient overview on INCA for each individual. This is displayed in the list if on the INCA platform. Default is NULL.

idAuthorisedToView

optional name of binary variable in data containing information on whether or not (1 = yes or 0 = no) the user running the app is authorised to see the id and idOverviewLink in the patient list on INCA. If id or idOverviewLink is provided, idAuthorisedToView must also be provided. Default is NULL.

outcome

vector with names(s) of variable(s) in data containing the variable(s) to be presented in the app, for example a quality indicator. Variable(s) must be of type logical, factor or numeric. Default is "outcome". Observe that observations with missing values for outcome are not included in the output.

outcomeNumericExcludeNeg

should negative values be excluded when presenting a numeric outcome? Particularly relevant for waiting times. Default is TRUE.

outcomeTitle

label(s) of the outcome(s) shown in the app. Must be the same length as argument outcome. Default is argument outcome.

textBeforeSubtitle

optional text placed before the subtitles in the tabs.

textAfterSubtitle

optional text placed after the subtitles in the tabs.

comment

optional comment printed under the sidebar panel.

description

vector of 3 character strings, or a list of vectors, one for each language, shown in the three subsections in the tab Beskrivning/Description. Default is c(NA, NA, NA).

geoUnitsHospital

optional name of variable in data containing hospital names. Variable must be of type character. If NULL or if variable is not found in 'data', hospital is not available as a level of presentation. Default is "sjukhus". At least one geoUnit must be given.

geoUnitsHospitalCode

optional name of variable in data containing hospital codes. Variable must be of type numeric. If NULL or if variable is not found in 'data', the list tab can not be displayed. The hospital codes are used to determine which patients to show in the list tab by matching it to the enviromental variable on INCA containing the hospital code of the logged in user. Default is "sjukhuskod".

geoUnitsHospitalSelected

optional name of the choice that should initially be selected in the list of hospitals. Variable must be of type character. Default is NULL.

geoUnitsCounty

optional name of variable in data containing county codes. Variable must be of type numeric. Can be either county of residence for the patient or the county the hospital belongs to. See details for valid values. If NULL or if variable is not found in 'data', county is not available as a level of presentation. Default is "landsting". At least one geoUnit must be given. To be implemented: Codes for county of hospital are fetched automatically from hospital codes.

geoUnitsRegion

optional name of variable in data containing region codes (1=Stockholm, 2=Uppsala-Örebro, 3=Sydöstra, 4=Södra, 5=Västra, 6=Norra, NA=Uppgift saknas). Variable must be of type numeric. Can be either region of residence for the patient or the region the hospital belongs to. If NULL or if variable is not found in 'data', region is not available as a level of presentation. Default is "region". At least one geoUnit must be given. To be implemented: Codes for region of hospital are fetched automatically from hospital codes.

geoUnitsPatient

if geoUnitsCounty/geoUnitsRegion is county/region of residence for the patient (LKF). If FALSE and a hospital is chosen by the user in the sidebar panel the output is highlighted for the respective county/region that the hospital belongs to. Default is FALSE.

geoUnitsDefault

optional default level of presentation. Valid values are "region", "county" and "hospital". Default is "county".

regionSelection

adds a widget to the sidebar panel with the option to show only one region at a time. Default is TRUE.

regionSelectionDefault

optional numeric value (1-6) which specifies the default selection in the list of regions. Default is NULL, which selects all regions.

regionLabel

change the default label of widget shown in the sidebar panel if regionSelection = TRUE. Should be a character vector of length 1 or a vector with a label corresponding to each language. Default is NULL.

period

name of variable in data containing time periods, for example date or year of diagnosis. Variable must be of type numeric or Date. Default is "period". If period = NULL then no period variable is required and period will not be included anywhere in the Shiny app.

periodDateLevel

If the variable in data containing time period is of type Date, how are the time periods going to be grouped? Allowed values are "year and "quarter", with default "year".

periodLabel

change the default label of the period widget in the sidebar panel. Should be a character vector of length 1 or a vector with a label corresponding to each language. Default is NULL.

periodDefaultStart

optional value which specifies the preselected default start of the period of interest. Default is NULL.

periodDefaultEnd

optional value which specifies the preselected default end of the period of interest. Default is NULL.

varOther

optional list of variable(s), other than period and geoUnits, to be shown in the sidebar panel. Arguments to the list are: var (name of variable in data), label (label shown over widget in sidebar panel), choices (which values of var should be shown, min, max for continuous variables), selected (which values should be selected when app is launched, default is all avalible values), multiple (should multiple choises be availible, default is TRUE), showInTitle (should selection be displayed in subtitle, default is TRUE). Observe that observations with missing values for varOthers are not included in the output.

allLabel

change the default label for the total in all plots and tables. Should be a character vector of length 1 or a vector with a label corresponding to each language. Default is NULL.

targetValues

optional vector or list of vectors (one for each outcome) with 1-2 target levels to be plotted in the tabs Jämförelse/Comparison and Trend for outcomes of type logical or numeric. If the outcome is numeric the target levels are shown when "Andel inom..."/"Proportion within..." is selected, and then only for the default propWithinValue.

funnelplot

adds a widget to the sidebar panel with the option to show a funnel plot in the tab Jämförelse/Comparison. Only applicaple for dichotomous variables. Default is FALSE.

sort

should the bars in tab Jämförelse/Comparison be sorted? Default is TRUE.

sortDescending

should the bars in tab Jämförelse/Comparison be plotted in descending order? The argument could have the same length as argument outcome, giving different values for each outcome. Default is NULL, which sorts logical outcomes in descending order and continuous outcomes in ascending order.

propWithinShow

display the choice "Andel inom..."/"Proportion within..." for numeric outcome(s). Default is TRUE.

propWithinUnit

change the default unit shown for numeric outcome when "Andel inom..."/"Proportion within..." is selected. Should be a character vector of length 1 or a vector with a label corresponding to each language. Default is NULL.

propWithinValue

vector with default value(s) shown for numeric outcome(s) when "Andel inom..."/"Proportion within..." is selected. The length of the vector should be either 1 or the length of outcome. Default is 30.

hideLessThan

value under which groups (cells) are supressed. Default is 5 and all values < 5 are set to 5.

gaPath

optional path to Google Analytics .js-file. Default is NULL.

npcrGroupPrivateOthers

should private hospitals be grouped when displaying data for the entire country. Applicable for NPCR. Default is FALSE.

Details

Valid values for geoUnitsCounty are:

geoUnitsPatient !geoUnitsPatient Text shown
1 10,11 Stockholm
3 12 Uppsala
4 13 Södermanland
5 21 Östergötland
6 22 Jönköping
7 23 Kronoberg
8 24,25 Kalmar
9 26 Gotland
10 27 Blekinge
12 28,30,41 Skåne
13 42 Halland
14 50,51,52,53 Västra Götaland
17 54 Värmland
18 55 Örebro
19 56 Västmanland
20 57 Dalarna
21 61 Gävleborg
22 62 Västernorrland
23 63 Jämtland
24 64 Västerbotten
25 65 Norrbotten
- 91,92,93,94,95,96 Övriga/privata - region
NA NA Uppgift saknas

If language = c("sv", "en") the following applies to arguments textBeforeSubtitle, textAfterSubtitle, comment, regionLabel, label in list varOther: if there are two values the first is used in the Swedish version and the second in the English version. If there is only one value this is recycled in both versions. The following applies to argument outcomeTitle, description: the arguments should be given in a list, the first listargument is used in the Swedish version and the second in the English version. The Swedish title(s) will be recycled if English is missing. The following applies to arguments outcome, geoUnitsHospital, geoUnitsCounty, geoUnitsRegion, period, var in list varOther: in the English version the variable name with the suffix _en (for example "outcome_en") will be used if this exists and otherwise the Swedish variable name will be recycled.

Value

A folder path/sv|en/folder containing: global.R, server.R, ui.R, data/data.RData, docs/description.html.

Author(s)

Fredrik Sandin, RCC Uppsala-Örebro

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
ind1 <- rccShiny2(
  data = rccShinyData,
  folder = "Indikator1",
  outcome = paste0("outcome",1:3),
  outcomeTitle = c("Dikotom", "Kontinuerlig", "Kategorisk"),
  description = c("Har beskrivs indikatorn.","Viktig information!","Information om variabler etc."),
  varOther = list(
    list(
      var = "age",
      label = "Alder vid diagnos"
    ),
    list(
      var = "stage",
      label = "Stadium",
      choices = c("I", "II"),
      selected = "I",
      multiple = TRUE,
      showInTitle = TRUE
    )
  ),
  funnelplot = TRUE
)
## Not run: 
library(shiny)
runApp("./sv/Indikator1")

cat(ind1) # displays the html link that can be used in index.html

## End(Not run)

# For Swedish/English version
rccShinyData$outcome1_en <- rccShinyData$outcome1
rccShiny2(
  language = c("sv", "en"),
  data = rccShinyData,
  folder = "Indikator2",
  outcome = "outcome1",
  outcomeTitle = list("Kontaktsjukskoterska", "Contact nurse"),
  textBeforeSubtitle = c("Nagot pa svenska","Something in English"),
  description = list(
    c("Har beskrivs indikatorn.","Viktig information!","Information om variabler etc."),
    c("Description of the indicator","Important information!","Information on variables etc.")
  ),
  varOther = list(
    list(
      var = "age",
     label = c("Alder vid diagnos","Age at diagnosis"),
      choices = c(0,120)
    )
  ),
  targetValues = c(95,99)
)

oc1lojo/rccshinydemo documentation built on Dec. 4, 2019, 12:37 a.m.