[adegenet-forum] data input from dataframe

Mark Coulson coulsonmw at gmail.com
Fri Nov 28 14:22:00 CET 2014


Ok, so I got rid of my 'River' column so it is now Col 1 is a population
label name and col 2 is an individual identifier. the remaining columns are
the genotype data now reading 4 digits (i.e. 0206, 1220, etc.).

scot <- read.table("Scotland_adegenet_no_river_names.txt", header=TRUE,
sep="\t", quote="\"", colClasses="character", stringsAsFactors=FALSE)

executing the conversion via

df2genind(scot, sep="", ind.names=scot$Individual, pop=scot$Population,
missing="0", ploidy=2, type="codom", ncode=4)

I still get the following error

Error in as.matrix(as.data.frame(strsplit(X, sep))) :
  error in evaluating the argument 'x' in selecting a method for function
'as.matrix': Error in data.frame(c("A", "n", "n", "A", "e"), c("A", "n",
"n", "A",  :
  arguments imply differing number of rows: 5, 10, 8, 7, 9, 12, 11, 16, 17,
14, 13, 15, 18, 25, 27, 23, 21, 26, 20, 19, 22, 24, 6, 4, 1


While I can get the genepop file accepted, being able to take a dataframe
as indicated would be much easier for what I am hoping to do and the size
of the datasets etc.

Cheers,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141128/f08b7878/attachment.html>


More information about the adegenet-forum mailing list