federatePCA: Federated PCA

View source: R/server_func.R

federatePCAR Documentation

Federated PCA

Description

Perform the principal component analysis for the virtual cohort.

Usage

federatePCA(loginFD,
                   logins,
                   func,
                   symbol,
                   ncomp = 2,
                   chunk = 500L,
                   mc.cores = 1)

Arguments

loginFD

Login information of the FD server (one of the servers containing cohort data).

logins

Login information of other servers containing cohort data.

func

Encoded definition of a function for preparation of raw data matrices. Two arguments are required: conns (list of Opal connections), symbol (name of the R symbol) (see datashield.assign).

symbol

Encoded vector of names of the R symbols to assign in the DataSHIELD R session on each server in logins. The assigned R variable will be used as the input raw data to compute covariance matrix for PCA. Other assigned R variables in func are ignored.

ncomp

Number of components. Default, 2.

chunk

Size of chunks into what the resulting matrix is partitioned. Default, 500L.

mc.cores

Number of cores for parallel computing. Default, 1.

Value

PCA object

Examples

## Not run: 
dataProc <- function(conns, symbol) {
    DSI::datashield.assign(conns, symbol, 'test.CNSIM',
        variables=c('LAB_TRIG', 'LAB_GLUC_ADJUSTED', 'PM_BMI_CONTINUOUS'))
}
federatePCA(.encode.arg(loginFD), .encode.arg(logins),
            .encode.arg(dataProc, serialize.it = T),
            .encode.arg("rawData"))

## End(Not run)

vanduttran/dsSSCP documentation built on Jan. 17, 2025, 1:47 a.m.