[adegenet-forum] Trouble converting to genid object

Caitlin Collins caitiecollins at gmail.com
Thu Oct 16 15:01:58 CEST 2014


Hi,

Sorry for the delay. I think the problem may be something simple to do with
the format or row and column names of the object test.
When I tried the example with the data you sent, the first approach worked
right away.

Can you try for me something perhaps silly just to rule this out as the
solution:

# replace filename below with the path to your file, wherever it is on your
computer
filename <- "C:/Cait/Work/adegenet forum Qs/test.txt"

# use read.table to read in the file anew to try to get it in the same
format that I have it in
test <- read.table(filename)
# confirm that it looks to have the correct dimensions, names, contents
head(test)

# try creating a genind object out of test using the first approach you put
forward
obj1 <- genind(test, ploidy=1, type="PA")
# confirm that a genind was created
obj1
# confirm that it looks the same as the original object when in matrix form
head(as.matrix(obj1))

Then please let me know if that works for you. If not, could you paste back
the results or errors you get from the above commands?

Best of luck.

Cheers,
Caitlin.

On Thu, Sep 25, 2014 at 11:04 AM, Jombart, Thibaut <t.jombart at imperial.ac.uk
> wrote:

>
> Hi there,
>
> it looks like a bug. I'll investigate and get back to you.
>
> 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 Jackie
> Lighten [Jackie.Lighten at Dal.Ca]
> *Sent:* 22 September 2014 12:59
> *To:* adegenet-forum at lists.r-forge.r-project.org
> *Subject:* [adegenet-forum] Trouble converting to genid object
>
>   Hi,
>
>  I am having trouble converting a presence/absence genotype data frame to
> a genid object
>
>  Please see attached for test data file.
>
>  Using
>
>  obj2 <- genind(test, ploidy=1, type="PA")
>
>  I get the error:
>
>  Error in `colnames<-`(`*tmp*`, value = c("L1", "L2")) :
>   length of 'dimnames' [2] not equal to array extent
>
>
>  Using
>
>  obj2 <- df2genind(test, ploidy=1, type="PA")
>
>  I get the error:
>
>  Error in `colnames<-`(`*tmp*`, value = "L1") :
>   length of 'dimnames' [2] not equal to array extent
> In addition: Warning messages:
> 1: In eval(expr, envir, enclos) : NAs introduced by coercion
> 2: In df2genind(test, ploidy = 1, type = "PA") :
>   entirely non-type marker(s) deleted
>
>
>  Any help would be much appreciated
>
>  Thanks,
>
>  Jack
>
> _______________________________________________
> adegenet-forum mailing list
> adegenet-forum at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141016/f47ab4ca/attachment.html>


More information about the adegenet-forum mailing list