Description Format Details Active bindings Methods Author(s)
Handles values in the pguIMP dataset that exceed the limits of quantification. This object is used by the shiny based gui and is not for use in individual R-scripts!
R6::R6Class object.
more information
loq
Returns the instance variable loq (tibble::tibble)
setLoq
Sets the instance variable loq. (tibble::tibble)
outliers
Returns instance variable outliers (tibble::tibble)
lloqSubstituteAlphabet
Returns the instance variable lloqSubstititeAlphabet (character)
lloqSubstituteAgent
Returns the instance variable lloqSubstituteAgent (character)
setLloqSubstituteAgent
Sets the instance variable lloqSubstituteAgent. (character)
uloqSubstituteAlphabet
Returns the instance variable uloqSubstititeAlphabet (character)
uloqSubstituteAgent
Returns the instance variable uloqSubstituteAgent (character)
setUloqSubstituteAgent
Sets the instance variable uloqSubstituteAgent. (character)
naHandlingAlphabet
Returns the instance variable naHandlingAlphabet (character)
naHandlingAgent
Returns the instance variable naHandlingAgentt (character)
setNaHandlingAgent
Sets the instance variable naHandlingAgentt (character)
loqStatistics
Returns the instance variable loqStatistics
new()
Mutates outlier candidates characterized as below LLOQ based on user defined actions.
Mutates outlier candidates characterized as above ULOQ based on user defined actions.
Searches for outliers in the given data frame. If an outlier was found, it is appended to the instance variable outliers. Indicates if an outlier was found.
Extends the instance variable outliers by one entry.
Tests if the provided attributes are known to the class.
Resets the class' instance variable outliers
Calculates statistics of outlier appearance. Stores it into the instance variable loqStatistics
Resets the class' instance variable loqStatistics
Resets the class by a data frame comprising information about LOQs.
Resets the class by a vector of attribute names. The Attributes' LOQs are initially assigned to na.
Clears the heap and
indicates that instance of pgu.limitaOfQuantification
is removed from heap.
Creates and returns a new pgu.limitsOfQuantification
object.
pgu.limitsOfQuantification$new(attribute_names = "character")
attribute_names
Vector of attribute names with to be analyzed by the loq object. (character)
A new pgu.limitsOfQuantification
object.
(pguIMP::pgu.limitsOfQuantification)
print()
Prints instance variables of a pgu.limitsOfQuantification
object.
pgu.limitsOfQuantification$print()
string
reset()
Resets the pguIMP::pgu.limitsOfQuantification object on the given parameters attribute_names and data_df
pgu.limitsOfQuantification$reset( attribute_names = "character", data_df = "tbl_df" )
attribute_names
Vector of attribute names with to be analyzed by the loq object. (character)
data_df
Dataframe comprising loq information. Feature names need to be 'attribute', 'LLOQ' and 'ULOQ'. (tibble::tibble)
fit()
Analyses the data dets for instances outside of the LOQ defined value interval.
pgu.limitsOfQuantification$fit(data_df = "tbl_df")
data_df
Dataframe to be analyzed
predict()
Mutates all outlier candidates based on user defined actions.
pgu.limitsOfQuantification$predict(data_df = "tbl_df")
data_df
The data to be analyzed. (tibble::tibble)
The revised data frame (tibble::tibble)
attribute_lloq()
Returns the attribute's specific lloq.
pgu.limitsOfQuantification$attribute_lloq(attribute = "character")
attribute
The attribute to be analyzed (character)
The attribute's lloq (numeric)
attribute_uloq()
Returns the attribute's specific uloq.
pgu.limitsOfQuantification$attribute_uloq(attribute = "character")
attribute
The attribute to be analyzed (character)
The attribute's uloq (numeric)
set_attribute_lloq()
sets the attribute's specific lloq to value.
pgu.limitsOfQuantification$set_attribute_lloq( attribute = "character", value = NA )
attribute
The attribute to be updated (character)
value
The value parsed to the attributes lloq (numeric)
set_attribute_uloq()
sets the attribute's specific uloq to value.
pgu.limitsOfQuantification$set_attribute_uloq( attribute = "character", value = NA )
attribute
The attribute to be updated (character)
value
The value parsed to the attributes lloq (numeric)
attribute_outliers()
Returns the detected outliers of a given attribute.
pgu.limitsOfQuantification$attribute_outliers(attribute = "character")
attribute
The attribute to be analyzed (character)
The attribute's outliers (tibble::tibble)
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | ####################
# data information #
####################
#' @description
#' Gathers and returns class information
dataInformation = function(){
self$loq %>%
dplyr::summarise_all(class) %>%
tidyr::gather(variable, class) %>%
return()
}, #function
####################
# output functions #
####################
#' @description
#' Merges dfData and dfMetadata and returns a fromatted data table.
#' @param dfData
#' The data to be analyzed.
#' (tibble::tibble)
#' @param dfMetadata
#' The data frame containing metadata.
#' (tibble::tibble)
#' @return
#' A formatted data table
#' (DT::datatable)
loqDataTable = function(dfData = "tbl_df", dfMetadata = "tbl_df"){
options(htmlwidgets.TOJSON_ARGS = list(na = 'string'))
t <- NULL
featureNames <- colnames(dfData)
tryCatch(
dfMerge <- dplyr::bind_cols(dfMetadata, dfData),
error = function(e){
print("error")
print(e)
dfMerge <- dfData
}#error
)#tryCatch
if(self$checkValidity(featureNames)){
t <- dfMerge %>%
dplyr::mutate_if(is.numeric, round, 3) %>%
DT::datatable(options = list(scrollX = TRUE,
scrollY = '350px',
paging = FALSE))
for (featureName in featureNames){
featureOutlier <- self$outliers %>%
dplyr::filter(feature == featureName) %>%
dplyr::mutate_if(is.numeric, round, 3)
if (nrow(featureOutlier) > 0){
t <- DT::formatStyle(t,
featureName,
backgroundColor = DT::styleEqual(dfMerge %>%
dplyr::select(!!featureName) %>%
dplyr::slice(featureOutlier[["measurement"]]) %>%
unlist() %>%
round(digits = 3),
featureOutlier[["color"]]))
}#if
}#for
}#if
return(t)
}, #function
#' @description
#' Returns a formatted data table with comrising the information of a user defined attribute's outliers.
#' @param obj
#' The data to be analyzed.
#' (tibble::tibble)
#' @param feature
#' The attribute to be analyzed
#' (character)
#' @return
#' A formatted data table
#' (DT::datatable)
loqFeatureTable = function(obj = "tbl_df", feature = "character"){
options(htmlwidgets.TOJSON_ARGS = list(na = 'string'))
t <- NULL
if(self$checkValidity(feature)){
featureOutlier <- self$outliers %>%
dplyr::filter(feature == !!feature) %>%
dplyr::mutate_if(is.numeric, round, 3)
dfFeature <- obj %>%
dplyr::mutate_if(is.numeric, round, 3)
print(dfFeature)
t <- dfFeature %>%
DT::datatable(options = list(scrollX = TRUE,
scrollY = '350px',
paging = FALSE))
if (nrow(featureOutlier) > 0){
t <- DT::formatStyle(
t,
feature,
backgroundColor = DT::styleEqual(dfFeature %>%
dplyr::select(!!feature) %>%
dplyr::slice(featureOutlier[["measurement"]]) %>%
unlist() %>%
round(digits = 3),
featureOutlier[["color"]]))
}#if
}#if
return(t)
}, #function
|
plot_loq_distribution()
Creates a plot of the instance variable loqStatistics.
pgu.limitsOfQuantification$plot_loq_distribution()
A plot. (ggplot2::ggplot)
attribute_bar_plot()
Creates a bar plot of a user defined attribute's value distribution. LOQs are indicated as dotted lines
pgu.limitsOfQuantification$attribute_bar_plot( data_df = "tbl_df", attribute = "character" )
data_df
The data to be analyzed. (tibble::tibble)
attribute
The attribute to be analyzed (character)
A bar plot. (ggplot2::ggplot)
attribute_box_plot_with_subset()
Creates a box plot of a user defined attribute's value distribution. LOQs are indicated as dotted lines
pgu.limitsOfQuantification$attribute_box_plot_with_subset( data_df = "tbl_df", attribute = "character" )
data_df
The data to be analyzed. (tibble::tibble)
attribute
The attribute to be analyzed (character)
A box plot. (ggplot2::ggplot)
attribute_plot()
Creates and returns a composite graphical analysis of the outlier analysis of a user defined attribute.
pgu.limitsOfQuantification$attribute_plot( data_df = "tbl_df", attribute = "character" )
data_df
The data to be analyzed. (tibble::tibble)
attribute
Attribute's name. (character)
Composite result plot. (gridExtra::grid.arrange)
clone()
The objects of this class are cloneable with this method.
pgu.limitsOfQuantification$clone(deep = FALSE)
deep
Whether to make a deep clone.
Sebastian Malkusch, malkusch@med.uni-frankfurt.de
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.