df2genind
converts a data.frame (or a matrix) into
a ncode
argument). Uncomplete strings are filled with "0" at the
begining.
The function genind2df
converts a df2genind(X, sep=NULL, ncode=NULL, ind.names=NULL, loc.names=NULL,
pop=NULL, missing=NA, ploidy=2, type=c("codom","PA"))
genind2df(x,pop=NULL, sep="", usepop=TRUE)
pop
or x@pop
should be used (TRUE, default) or not (FALSE).df2genind
;
a matrix of biallelic genotypes for genind2df
sep
argument ===
this character is directly used in reguar expressions like
gsub
, and thus require some characters to be preceeded by
double backslashes. For instance, "/" works but "|" must be coded as "\\|".import2genind
, read.genetix
,
read.fstat
, read.structure
df <- data.frame(loc1=c("11","11","12","32"),
loc2=c(NA,"34","55","15"),loc3=c("22","22","21","22"))
row.names(df) <- .genlab("geontype",4)
df
obj <- df2genind(df)
obj
truenames(obj)
genind2df(obj)
Run the code above in your browser using DataLab