rccShiny2 | R Documentation |
returns shiny apps that can be used as a complement to the annual reports from the cancer quality registries in Sweden.
rccShiny2( inca = FALSE, incaScript = NULL, incaIncludeList = TRUE, folder = "ind", folderLinkText = NULL, 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", geoUnitsHospitalAlt = "sjukhus_alt", geoUnitsHospitalCode = "sjukhuskod", geoUnitsHospitalSelected = NULL, geoUnitsHospitalLabel = NULL, geoUnitsCounty = "landsting", geoUnitsCountyLabel = NULL, geoUnitsRegion = "region", geoUnitsRegionLabel = NULL, geoUnitsPatient = FALSE, geoUnitsDefault = "county", regionSelection = TRUE, regionSelectionDefault = NULL, regionLabel = NULL, period = "period", periodDateLevel = "year", periodLabel = NULL, periodDefaultStart = NULL, periodDefaultEnd = NULL, periodSplitDefault = FALSE, varOtherComparison = NULL, varOther = NULL, allLabel = NULL, targetValues = NULL, funnelplot = FALSE, sort = TRUE, sortDescending = NULL, propWithinShow = TRUE, propWithinUnit = NULL, propWithinValue = 30, prob = c(0.25, 0.5, 0.75), hideLessThan = 5, hideLessThanGroup = FALSE, hideLessThanCell = 0, gaPath = NULL, npcrGroupPrivateOthers = FALSE, outputHighcharts = FALSE, includeTabs = c("compare", "table", "map", "trend", "description"), includeMissingColumn = FALSE )
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". |
folderLinkText |
name displayed in ready-to-use html link returned by the function. Default is NULL, which results in the use of arguments outcomeTitle, folder and language to construct a name depending on the number of outcomes. |
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. A variable name in 'outcome' can be left as NA, in which case the number of observations will be displayed as outcome in the app. |
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. |
geoUnitsHospitalAlt |
optional name of variable in data containing alternative hospital names to be used when only one region is selected to be shown. Variable must be of type character. If NULL or if variable is not found in 'data', geoUnitsHospital is used. Default is "sjukhus_alt". |
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. |
geoUnitsHospitalLabel |
optional label for 'geoUnitsHospital'. Should be a character vector of length 1 or a vector with a label corresponding to each language. Default is NULL and labels will be the old default label. |
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. |
geoUnitsCountyLabel |
optional label for 'geoUnitsCounty'. Should be a character vector of length 1 or a vector with a label corresponding to each language. Default is NULL and labels will be the old default label.. |
geoUnitsRegion |
optional name of variable in data containing region codes (1=Stockholm, 2=Mellansverige, 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. |
geoUnitsRegionLabel |
optional label for 'geoUnitsRegion'. Should be a character vector of length 1 or a vector with a label corresponding to each language. Default is NULL and labels will be the old default label. |
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", "hospital", and any of the variable names (var) in varOtherComparison. 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. |
periodSplitDefault |
Should period be split by default? Default is FALSE. |
varOtherComparison |
optional list of variable(s) which beside geoUnits is to be available as level of comparison in the sidebar panel. Arguments to the list are: var (name of variable in data) and label (optional label shown in the list in sidebar panel, defaults to var if not given). |
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 available values), multiple (should multiple choises be availible, default is TRUE), showInTitle (should selection be displayed in subtitle, default is TRUE), sliderStep (interval between each selectable value on the slider for a numeric variable, default is 1). 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. |
prob |
a vector of quantiles for summarizing indicator if indicator is numeric. Defaults to c(0.25,0.5,0.75). |
hideLessThan |
value under which groups are supressed. Default is 5 and all values < 5 are set to 5 unless inca = TRUE. |
hideLessThanGroup |
should groups smaller than hideLessThan be grouped together in the comparison figure? Default is FALSE. |
hideLessThanCell |
if a cell for a group falls below this value, the absolute number for the group is supressed and only proportion or median etc. is displayed. Default is 0 (disabled). |
gaPath |
optional path to Google Analytics .js-file. Default is NULL. |
npcrGroupPrivateOthers |
deprecated argument, see geoUnitsHospitalAlt. |
outputHighcharts |
should Highcharts be used to draw the figures? A logical vector of length 1 or a character vector with tab names ("compare", "map" and/or "trend"). Default is FALSE. |
includeTabs |
vector containing names of which tabs should be included in the shiny app. Default is c("compare", "table", "map", "trend", "description"). |
includeMissingColumn |
Include a column in Table tab for the number of post with a missing value. Default is FALSE. |
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, geoUnitsHospitalAlt, 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.
A folder path/sv|en/folder containing: global.R, server.R, ui.R, data/data.RData, docs/description.html.
Fredrik Sandin, RCC Mellansverige
## Not run: ind1 <- rccShiny2( data = rccShinyData, folder = "Indikator1", folderLinkText = "Indikator 1", 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 ) shiny::runApp("./sv/Indikator1") cat(ind1) # displays the html link that can be used in index.html # For Swedish/English version rccShinyData$outcome1_en <- rccShinyData$outcome1 rccShiny2( language = c("sv", "en"), data = rccShinyData, folder = "Indikator2", folderLinkText = c("Indikator 2", "Indicator 2"), 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) ) # Using stage as level of presentation rccShiny2( language = c("sv", "en"), data = rccShinyData, folder = "Indikator3", outcome = "outcome1", outcomeTitle = list("Dikotom", "Dichotomous"), description = list( c("Beskrivning!", "Viktigt!", "Information!"), c("Description!", "Important!", "Information!") ), geoUnitsDefault = "stage", varOtherComparison = list( list( var = "stage", label = c( "Stadium", "Stage" ) ) ), varOther = list( list( var = "age", label = c( "Alder vid diagnos", "Age at diagnosis" ) ) ), sort = FALSE ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.