forked from thehyve/ShinyDeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CohortDiagnostics output for Breast Cancer work
- Loading branch information
1 parent
0101a17
commit 0767a96
Showing
24 changed files
with
4,496 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
camelCaseToSnakeCase <- function(string) { | ||
string <- gsub("([A-Z])", "_\\1", string) | ||
string <- tolower(string) | ||
string <- gsub("([a-z])([0-9])", "\\1_\\2", string) | ||
return(string) | ||
} | ||
|
||
|
||
camelCaseToTitleCase <- function(string) { | ||
string <- gsub("([A-Z])", " \\1", string) | ||
string <- gsub("([a-z])([0-9])", "\\1 \\2", string) | ||
substr(string, 1, 1) <- toupper(substr(string, 1, 1)) | ||
return(string) | ||
} | ||
|
||
|
||
truncateStringDef <- function(columns, maxChars) { | ||
list( | ||
targets = columns, | ||
render = DT::JS(sprintf("function(data, type, row, meta) {\n | ||
return type === 'display' && data != null && data.length > %s ?\n | ||
'<span title=\"' + data + '\">' + data.substr(0, %s) + '...</span>' : data;\n | ||
}", maxChars, maxChars)) | ||
) | ||
} | ||
|
||
minCellCountDef <- function(columns) { | ||
list( | ||
targets = columns, | ||
render = DT::JS("function(data, type) { | ||
if (type !== 'display' || isNaN(parseFloat(data))) return data; | ||
if (data >= 0) return data.toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1,'); | ||
return '<' + Math.abs(data).toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1,'); | ||
}") | ||
) | ||
} | ||
|
||
minCellPercentDef <- function(columns) { | ||
list( | ||
targets = columns, | ||
render = DT::JS("function(data, type) { | ||
if (type !== 'display' || isNaN(parseFloat(data))) return data; | ||
if (data >= 0) return (100 * data).toFixed(1).replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1,') + '%'; | ||
return '<' + Math.abs(100 * data).toFixed(1).replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1,') + '%'; | ||
}") | ||
) | ||
} | ||
|
||
minCellRealDef <- function(columns, digits = 1) { | ||
list( | ||
targets = columns, | ||
render = DT::JS(sprintf("function(data, type) { | ||
if (type !== 'display' || isNaN(parseFloat(data))) return data; | ||
if (data >= 0) return data.toFixed(%s).replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1,'); | ||
return '<' + Math.abs(data).toFixed(%s).replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1,'); | ||
}", digits, digits)) | ||
) | ||
} | ||
|
||
styleAbsColorBar <- function(maxValue, colorPositive, colorNegative, angle = 90) { | ||
DT::JS(sprintf("isNaN(parseFloat(value))? '' : 'linear-gradient(%fdeg, transparent ' + (%f - Math.abs(value))/%f * 100 + '%%, ' + (value > 0 ? '%s ' : '%s ') + (%f - Math.abs(value))/%f * 100 + '%%)'", | ||
angle, maxValue, maxValue, colorPositive, colorNegative, maxValue, maxValue)) | ||
} | ||
|
||
sumCounts <- function(counts) { | ||
result <- sum(abs(counts)) | ||
if (any(counts < 0)) { | ||
return(-result) | ||
} else { | ||
return(result) | ||
} | ||
|
||
} |
Oops, something went wrong.