summary.loci | R Documentation |
These functions print and summarize table of alleles and loci (objects
of class "loci"
).
## S3 method for class 'loci'
print(x, details = FALSE, ...)
## S3 method for class 'loci'
summary(object, ...)
## S3 method for class 'summary.loci'
print(x, ...)
## S3 method for class 'loci'
x[i, j, drop = FALSE]
## S3 method for class 'summary.loci'
plot(x, loci, what = "both", layout = 1, col = c("blue", "red"), ...)
x , object |
an object of class |
details |
a logical value: if |
i , j |
indices of the rows and/or columns to select or to drop. They may be numeric, logical, or character (in the same way than for standard R objects). |
drop |
a logical specifying whether to returned an object of
the smallest dimension possible, i.e., may return a vector or a
factor if |
loci |
the loci (genes) to be plotted. By default, all loci are plotted. |
what |
the frequencies to be plotted. Three choices are possible:
|
layout |
the number of graphs to be plotted simultaneously. |
col |
the colours used for the barplots. |
... |
further arguments to be passed to or from other methods. |
Genotypes not observed in the data frame are not counted.
When using the [
method, if only one column is extracted and
the option drop = TRUE
, or if the returned data frame has no ‘locus’
column, then the class "loci"
is dropped. The option drop = FALSE
(default) keeps the class (see examples).
An object of class "loci"
can be edited in the R data editor
with, e.g., fix(x)
or x <- edit(x)
.
summary.loci
computes the absolute frequencies (counts); see
the examples on how to compute the relative frequencies (proportions).
summary.loci
returns a list with the genes as names and each
element made a list with two vectors "genotype"
and
"allele"
with the frequencies (numbers) of genotypes and
alleles, respectively. The names of these two vectors are the observed
genotypes and alleles.
print
and plot
methods return NULL.
Emmanuel Paradis
read.loci
, getAlleles
, edit.loci
data(jaguar)
s <- summary(jaguar)
## Not run:
## works if the device is large enough:
plot(s, layout = 30, las = 2)
layout(1)
## End(Not run)
## compute the relative frequencies:
rapply(s, function(x) x/sum(x), how = "replace")
## extract a single locus:
jaguar[, 1]
jaguar[, 1, drop = TRUE] # returns a vector
jaguar[[1]] # also returns a vector
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.