Description Usage Arguments Details Value Author(s) Examples
This is similar to the R base function 'cov'.
1 2 |
datasources |
a list of opal object(s) obtained
after login in to opal servers; these objects hold also
the data assign to R, as |
x |
a character, the name of a numerical vector, matrix or dataframe |
y |
NULL (default) or the name of avector, matrix or data frame with compatible dimensions to x. |
naAction |
a character string giving a method for computing covariances in the presence of missing values. This must be one of the strings: "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs". The default value is set to "pairwise.complete.obs" |
In addition to computing covariances; this function, unlike the R base function 'cov', produces a table outlining the number of complete cases to allow for the user to make a decision about the 'relevance' of the covariance based on the number of complete cases included in the covariance calculations.
a list containing the results of the test
GAYE, A.
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 | {
# load that contains the login details
data(logindata)
# login and assign specific variable(s)
# (by default the assigned dataset is a dataframe named 'D')
myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER')
opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)
# Example 1: generate the covariance matrix for the assigned dataset 'D'
# which contains 4 vectors (2 continuous and 1 categorical)
ds.cov(x='D')
# Example 2: calculate the covariance between two vectors
# (first assign the vectors from 'D')
ds.assign(newobj='labhdl', toAssign='D$LAB_HDL')
ds.assign(newobj='labtsc', toAssign='D$LAB_TSC')
ds.assign(newobj='gender', toAssign='D$GENDER')
ds.cov(x='labhdl', y='labtsc')
ds.cov(x='labhdl', y='gender')
# clear the Datashield R sessions and logout
datashield.logout(opals)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.