MiSpecimenSample: Select values from factor vector

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/MiSpecimenSample.R

Description

This function takes factor vector with multiple levels and selects values for 1 or 2 levels only.

Usage

1
MiSpecimenSample(x, group1, group2 = NULL)

Arguments

x

factor vector

group1

value of factor level to sample

group2

additional value of factor level to sample

Details

This function is ment for sampling specimens for binary classification when they belong to more than two groups. The aim is to create factor vector with only two levels specifying specimens in the columns of corresponding microarray expression matrix. It should be used together with MiDataSample that samples columns of microarray expression matrix in the same way.

Value

factor vector with values for 1 or 2 levels only

Author(s)

Elena N. Filatova

See Also

MiDataSample

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#get gene expression and specimen data
data("IMexpression");data("IMspecimen")
dim(IMexpression) # 100 columns (genes/transcripts) - 89 specimens
colnames(IMexpression)[1:10] # look at first 10 columns of matrix - specimens IDs
IMspecimen[1:10,] # specimens IDs and group factor - diagnoses in attendant vector
# note that specimens in matrix columns are in the same order as specimens in description data
# select specimens with only EBV and NORM diagnoses (and sample the description data as well)
SampleMatrix<-MiDataSample(IMexpression, IMspecimen$diagnosis, "ebv", "norm")
SampleSamples<-MiSpecimenSample(IMspecimen$diagnosis, "ebv", "norm")
dim(SampleMatrix)# only 68 specimens with EBV and NORM diagnoses left
colnames(SampleMatrix)[1:10]
SampleSamples[1:10] # corresponding diagnoses

MiDA documentation built on May 2, 2019, 4:06 p.m.

Related to MiSpecimenSample in MiDA...