utils.check.datatype {dartR.base} | R Documentation |
Utility function to check the class of an object passed to a function
Description
WARNING: UTILITY SCRIPTS ARE FOR INTERNAL USE ONLY AND SHOULD NOT BE USED BY END USERS AS THEIR USE OUT OF CONTEXT COULD LEAD TO UNPREDICTABLE OUTCOMES.
Usage
utils.check.datatype(
x,
accept = c("genlight", "SNP", "SilicoDArT"),
verbose = NULL
)
Arguments
x |
Name of the genlight object, dist matrix, data matrix, glPCA, or fixed difference list (fd) [required]. |
accept |
Vector containing the classes of objects that are to be accepted [default c('genlight','SNP','SilicoDArT']. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default NULL, unless specified using gl.set.verbosity]. |
Details
Most functions require access to a genlight object, dist matrix, data matrix or fixed difference list (fd), and this function checks that a genlight object or one of the above has been passed, whether the genlight object is a SNP dataset or a SilicoDArT object, and reports back if verbosity is >=2.
This function checks the class of passed object and sets the datatype to 'SNP', 'SilicoDArT', 'dist', 'mat', or class[1](x) as appropriate. Note also that this function checks to see if there are individuals or loci scored as all missing (NA) and if so, issues the user with a warning. Note: One and only one of gl.check, fd.check, dist.check or mat.check can be TRUE.
Value
datatype, 'SNP' for SNP data, 'SilicoDArT' for P/A data, 'dist' for a distance matrix, 'mat' for a data matrix, 'glPCA' for an ordination file, or class(x)[1].
Author(s)
Custodian: Arthur Georges – Post to https://groups.google.com/d/forum/dartr
See Also
Other utilities:
gl.alf()
,
utils.dart2genlight()
,
utils.dist.binary()
,
utils.flag.start()
,
utils.hamming()
,
utils.het.pop()
,
utils.impute
,
utils.is.fixed()
,
utils.jackknife()
,
utils.n.var.invariant()
,
utils.plot.save()
,
utils.read.fasta()
,
utils.read.ped()
,
utils.recalc.avgpic()
,
utils.recalc.callrate()
,
utils.recalc.freqhets()
,
utils.recalc.freqhomref()
,
utils.recalc.freqhomsnp()
,
utils.recalc.maf()
,
utils.reset.flags()
,
utils.transpose()
Examples
datatype <- utils.check.datatype(testset.gl)
datatype <- utils.check.datatype(as.matrix(testset.gl),accept='matrix')
fd <- gl.fixed.diff(testset.gl)
datatype <- utils.check.datatype(fd,accept='fd')