Learn R Programming

cocoreg (version 0.1.1)

variation_shared_by: Return a specific variation component

Description

Variation can be shared by: 'all' all datasets 'subset' a subset of the datasets (excluding variation already in 'all') 'all_and_subset' a union of the above

The returned data never contains noise (which is considered to be part of each datasets unique variation). The linear toy datasets do not contain variation unique to a dataset other than pure noise.

Usage

variation_shared_by(dc, type, center = T, scale = F)

Arguments

dc
A data collection from one of the create_syn_data_*() functions
type
Type of variation to extract, allowed values c('all','subset','all_and_subset')
center
(optional) Should the output data be centered?
scale
(optional) Should the output data be scaled?

Value

A list of data.frames containing the desired variation component

Examples

Run this code
## Not run: ------------------------------------
# dc <- create_syn_data_toy()
# ldSharedByAll = variation_shared_by(dc, "all", center = F) 
# ldSharedBySome = variation_shared_by(dc, "subset", center = F) 
# ldNonUnique = variation_shared_by(dc, "all_and_subset", center = F) 
# dNoise <- mapply(function(x,y){x-y}, x=dc$data, y=ldNonUnique, SIMPLIFY = F)
# ggplot_dclst(list(observed = dc$data,
#                 shared.by.all = ldSharedByAll,
#                 shared.by.some = ldSharedBySome,
#                 noise = dNoise),
#             ylim = c(-3, 3))
## ---------------------------------------------

Run the code above in your browser using DataLab