[adegenet-forum] data input

Jombart, Thibaut t.jombart at imperial.ac.uk
Fri Nov 28 13:36:31 CET 2014


Hello Mark,

yes, R will read stuff looking like integers as integers, so you want to specify the type as 'character' when reading the file in, and make sure characters are not converted to factors automatically (option stringsAsFactors).

I suspect "x" here may still contain non-allele data, so you may want to double check that.

Cheers
Thibaut
________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Mark Coulson [coulsonmw at gmail.com]
Sent: 28 November 2014 11:57
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] data input

Hello,

I am trying to read in a dataframe (rather than a genepop or other format) with 1 column as population, 1 column as individual and 1 column as River (which I would like as the @other tab). I've coded my alleles as 2-digit codes with no separator. In excel this looks like 1134 or 0230 for example.

I've done df2genind(x, sep=NULL, ind.names=x$Individual, pop=x$Population, missing="0", ploidy=2) but I get

Error in df2genind(scot, sep = NULL, ind.names = scot$Individual, pop = scot$Population,  :
  2 alleles cannot be coded by a total of 27 characters

I notice that R is reading any genotype beginning with a 0 as 230 instead of 0230. I may also want to include some additional 'other' variables such as coordinates so looking for options for bringing in a dataframe instead of particular genetic formats.

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


More information about the adegenet-forum mailing list