-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinCatchAnalysis_0_BaseObject.qmd
63 lines (32 loc) · 3.25 KB
/
FinCatchAnalysis_0_BaseObject.qmd
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
53
54
55
56
57
58
59
60
61
62
63
# Base Object
## Purpose
Provides a common interface for results regardless of what analysis is run.
### Variables
- analysisTitle - (string) Description of the analysis stored in the object, used for headers and titles in reports and displays
- exportName - (string) Name used when generating file download names, no spaces or punctuation should be used
- descriptionText - (string) Markdown text to be displayed in outputs prior to the output tables and figures
- tableTitle- (list\<string\>) Title text to be used on object tables, each item in list corresponds to one table output in printTables
- groupByVars - (string) Comma-separated string of variable name to use as grouping variables within the tables
- surveys - (dataframe) Dataframe containing survey-level data
- samples - (dataframe) Dataframe containing samples
- results - (list\<dataframes\>) List of dataframes containing results of analysis
- plots - (list\<ggplot objects\>) List of ggPlot objects created from analysis
- errors - (list\<string\>) Error messages created during analysis
- warnings- (list\<string\>) Warning messages created during analysis
- groupHeaderBackgroundColor - (string) Color to be used in background of group header within table, groups are determined by the groupByVars variable, used in HTML outputs only
- groupSummaryBackgroundColor - (string) Color to be used in the summary row of each group within table, groups are determined by the groupByVars variable, used in HTML outputs only
- gtTheme - (string) Name of gt tables theme from the gtExtras package, used in HTML outputs only
### Methods
- print - method used by R to print the results variable
- exportJson - method used to create and save Json file of results, no default implementation
- exportCsv - method used to create and save Csv file of results, no default implementation
- createTable - generic table to create both Latex and Html tables for object
- createTableLatex - creates table formatted for Latex, default implementation simply calls and returns createTable
- createTableHtml - creates table formatted for Html, default implementation simply calls and returns createTable
- printTablesLatex - called to output all tables in a LaTex format, this does not include any formatting or table specific code which is included in the createTable? functions, but instead iterates through multiple table outputs
- printTablesHtml - called to output all tables in a Html format, this does not include any formatting or table specific code which is included in the createTable? functions, but instead iterates through multiple table outputs
- printTablesAuto - tests the incoming call for a LaTex environment and calls either printTablesLatex or printTablesHtml as appropiate, used for markdown reports that can be user-generated in mulitple formats
- iterateSurvey - a generic function that crawls through two loops, one for survey groups, one for specific tables (one analysis may output mulitiple tables) and is called by the printTable functions
- printPlots - called to output ggplot outputs stored as part of analysis
## Overriding Base Object
The fc_base object can be extended and customized to produce objects for specific analysis. See details in "Creating Analyis Chapter".