<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><br>
<div>Hi, <br>
from ?df2genind:<br>
" The function ‘df2genind’ converts a data.frame (or a matrix) into<br>
a genind object. The data.frame must meet the following<br>
requirements:<br>
- genotypes are in row (one row per genotype)<br>
- markers are in columns<br>
- each element is a string of characters coding alleles<br>
"<br>
<br>
Which 'scot' does not fulfil, as it contains no-marker data. <br>
You probably want to use something like:<br>
df2genind(scot[, -(1:2)], ...)<br>
<br>
Cheers<br>
Thibaut<br>
<br>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF560304"><font color="#000000" face="Tahoma" size="2"><b>From:</b> adegenet-forum-bounces@lists.r-forge.r-project.org [adegenet-forum-bounces@lists.r-forge.r-project.org] on behalf of Mark Coulson [coulsonmw@gmail.com]<br>
<b>Sent:</b> 28 November 2014 13:22<br>
<b>To:</b> adegenet-forum@lists.r-forge.r-project.org<br>
<b>Subject:</b> [adegenet-forum] data input from dataframe<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>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.).</div>
<div><br>
</div>
scot <- read.table("Scotland_adegenet_no_river_names.txt", header=TRUE, sep="\t", quote="\"", colClasses="character", stringsAsFactors=FALSE)<br>
<div><br>
</div>
<div>executing the conversion via</div>
<div><br>
</div>
<div>df2genind(scot, sep="", ind.names=scot$Individual, pop=scot$Population, missing="0", ploidy=2, type="codom", ncode=4)<br>
</div>
<div><br>
</div>
<div>I still get the following error</div>
<div><br>
</div>
<div>
<div>Error in as.matrix(as.data.frame(strsplit(X, sep))) : </div>
<div> 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", : </div>
<div> 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</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div>Cheers,</div>
<div>Mark</div>
</div>
</div>
</div>
</div>
</body>
</html>