summary.sgsObj: Prints summary of sgsObj data structure

Description Usage Arguments Value See Also Examples

View source: R/dataio.R

Description

Prints summary of sgsObj data structure

Usage

1
2
## S3 method for class 'sgsObj'
summary(object, ...)

Arguments

object

An sgsObj to be summarized

...

arguments passed to summary

Value

A printed summary of..

See Also

createSgsObj for how to create a sgsObj

Examples

 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
## Simulate genetic data
Nind = 100 # Number of individuals
Nloci = 5 # Number of loci
Nallele = 10 # Number of alleles per loci

## Set up data frame and generate random spatial locations
dat <- data.frame(id = 0:(Nind - 1))
dat$x = runif(Nind, 0, 100)
dat$y = runif(Nind, 0, 100)

## Simulate Random genetic data and assign loci names
for (loci in 1:Nloci) {
 loci_name_a = paste("Loc", loci, "_A", sep = "")
 loci_name_b = paste("Loc", loci, "_B", sep = "")
 dat[loci_name_a] <- sample.int(Nallele, Nind, replace = TRUE)
 dat[loci_name_b] <- sample.int(Nallele, Nind, replace = TRUE)
}

## Convert to sgsObj
sgsObj = createSgsObj(sample_ids = dat$id,
                     genotype_data = dat[, 4:(Nloci*2 + 3)],
                     ploidy = 2,
                     x_coords = dat$x,
                     y_coords = dat$y)
summary(sgsObj)

lukembrowne/sgsR documentation built on May 21, 2019, 8:58 a.m.