[adegenet-forum] adegenet-forum Digest, Vol 74, Issue 9

Francesco Montinaro francesco.montinaro at gmail.com
Thu Oct 23 17:19:19 CEST 2014


Hi,
I think that the problem is that since a genind object is a list, the nrow
is NULL.

Probably you want to sample from object$tab instead.

Hope it helps.

Best



Francesco Montinaro

On 23 October 2014 16:04, <
adegenet-forum-request at lists.r-forge.r-project.org> wrote:

> Send adegenet-forum mailing list submissions to
>         adegenet-forum at lists.r-forge.r-project.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
>
> or, via email, send a message with subject or body 'help' to
>         adegenet-forum-request at lists.r-forge.r-project.org
>
> You can reach the person managing the list at
>         adegenet-forum-owner at lists.r-forge.r-project.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of adegenet-forum digest..."
>
>
> Today's Topics:
>
>    1. repooling random rows from genind objects (Spencer Bruce)
>    2. Re: repooling random rows from genind objects (Jombart, Thibaut)
>    3. Re: repooling random rows from genind objects (Spencer Bruce)
>    4. Re: repooling random rows from genind objects (Jombart, Thibaut)
>    5. Re: repooling random rows from genind objects (Spencer Bruce)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 23 Oct 2014 10:29:10 -0400
> From: Spencer Bruce <goatsrunfaster at gmail.com>
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: [adegenet-forum] repooling random rows from genind objects
> Message-ID:
>         <CAGjKGeaQyQ=
> UFFOSerHR1qeKXHSwVzF-0whQf2do83wOV38s5w at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hello All!
>
> I have three seperate populations as genind objects. What I would like to
> do is pull a certain number of random individuals from each, to form a new
> single genind population.
>
> I would then like individuals from this new genind population to mate
> randomly, producing another genind object which would contain their
> offspring.
>
> Below is the code I came up with (which does not work):
>
> Year1 <- repool(F1[sample(nrow(F1), 500), ], pop1[sample(nrow(pop1), 750),
> ], pop2[sample(nrow(pop2), 750), ], n=2000)
>
> Year2 <- hybridize(Year1[sample(nrow(Year1), 1000), ],
> Year1[sample(nrow(Year1), 1000), ], n=2000)
>
>
> any help would be greatly appreciated!
>
> Best,
> Spencer
>
> --
> Spencer A Bruce
> 200 Washington St.
> Troy, NY 12180
> 518 225 0787
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141023/cb94a767/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 23 Oct 2014 14:50:24 +0000
> From: "Jombart, Thibaut" <t.jombart at imperial.ac.uk>
> To: Spencer Bruce <goatsrunfaster at gmail.com>,
>         "adegenet-forum at lists.r-forge.r-project.org"
>         <adegenet-forum at lists.r-forge.r-project.org>
> Subject: Re: [adegenet-forum] repooling random rows from genind
>         objects
> Message-ID:
>         <2CB2DA8E426F3541AB1907F98ABA6570ABE6AE7F at icexch-m1.ic.ac.uk>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Hello,
> hard to figure out what is wrong without the error message..
> 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 Spencer
> Bruce [goatsrunfaster at gmail.com]
> Sent: 23 October 2014 15:29
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: [adegenet-forum] repooling random rows from genind objects
>
> Hello All!
>
> I have three seperate populations as genind objects. What I would like to
> do is pull a certain number of random individuals from each, to form a new
> single genind population.
>
> I would then like individuals from this new genind population to mate
> randomly, producing another genind object which would contain their
> offspring.
>
> Below is the code I came up with (which does not work):
>
> Year1 <- repool(F1[sample(nrow(F1), 500), ], pop1[sample(nrow(pop1), 750),
> ], pop2[sample(nrow(pop2), 750), ], n=2000)
>
> Year2 <- hybridize(Year1[sample(nrow(Year1), 1000), ],
> Year1[sample(nrow(Year1), 1000), ], n=2000)
>
>
> any help would be greatly appreciated!
>
> Best,
> Spencer
>
> --
> Spencer A Bruce
> 200 Washington St.
> Troy, NY 12180
> 518 225 0787
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141023/c43c29fe/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 3
> Date: Thu, 23 Oct 2014 10:52:59 -0400
> From: Spencer Bruce <goatsrunfaster at gmail.com>
> To: "Jombart, Thibaut" <t.jombart at imperial.ac.uk>
> Cc: "adegenet-forum at lists.r-forge.r-project.org"
>         <adegenet-forum at lists.r-forge.r-project.org>
> Subject: Re: [adegenet-forum] repooling random rows from genind
>         objects
> Message-ID:
>         <
> CAGjKGeZhjLhurZbKiMZxSmZV_GFC3quw58FPt06LrXwakRDPeA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Error message:
>
> Error in sample.int(length(x), size, replace, prob) :
>   invalid first argument
>
> On Thu, Oct 23, 2014 at 10:50 AM, Jombart, Thibaut <
> t.jombart at imperial.ac.uk
> > wrote:
>
> >
> > Hello,
> > hard to figure out what is wrong without the error message..
> > 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 Spencer
> > Bruce [goatsrunfaster at gmail.com]
> > *Sent:* 23 October 2014 15:29
> > *To:* adegenet-forum at lists.r-forge.r-project.org
> > *Subject:* [adegenet-forum] repooling random rows from genind objects
> >
> >   Hello All!
> >
> >  I have three seperate populations as genind objects. What I would like
> > to do is pull a certain number of random individuals from each, to form a
> > new single genind population.
> >
> >  I would then like individuals from this new genind population to mate
> > randomly, producing another genind object which would contain their
> > offspring.
> >
> >  Below is the code I came up with (which does not work):
> >
> >  Year1 <- repool(F1[sample(nrow(F1), 500), ], pop1[sample(nrow(pop1),
> > 750), ], pop2[sample(nrow(pop2), 750), ], n=2000)
> >
> >  Year2 <- hybridize(Year1[sample(nrow(Year1), 1000), ],
> > Year1[sample(nrow(Year1), 1000), ], n=2000)
> >
> >
> >  any help would be greatly appreciated!
> >
> >  Best,
> > Spencer
> >
> >  --
> > Spencer A Bruce
> > 200 Washington St.
> > Troy, NY 12180
> > 518 225 0787
> >
>
>
>
> --
> Spencer A Bruce
> 200 Washington St.
> Troy, NY 12180
> 518 225 0787
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141023/19bc54c8/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 4
> Date: Thu, 23 Oct 2014 14:54:53 +0000
> From: "Jombart, Thibaut" <t.jombart at imperial.ac.uk>
> To: Spencer Bruce <goatsrunfaster at gmail.com>
> Cc: "adegenet-forum at lists.r-forge.r-project.org"
>         <adegenet-forum at lists.r-forge.r-project.org>
> Subject: Re: [adegenet-forum] repooling random rows from genind
>         objects
> Message-ID:
>         <2CB2DA8E426F3541AB1907F98ABA6570ABE6AE93 at icexch-m1.ic.ac.uk>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
> What does nrow(F1) and other nrow(...)'s say?
>
>
>
>
> ________________________________
> From: Spencer Bruce [goatsrunfaster at gmail.com]
> Sent: 23 October 2014 15:52
> To: Jombart, Thibaut
> Cc: adegenet-forum at lists.r-forge.r-project.org
> Subject: Re: [adegenet-forum] repooling random rows from genind objects
>
> Error message:
>
> Error in sample.int<http://sample.int>(length(x), size, replace, prob) :
>   invalid first argument
>
> On Thu, Oct 23, 2014 at 10:50 AM, Jombart, Thibaut <
> t.jombart at imperial.ac.uk<mailto:t.jombart at imperial.ac.uk>> wrote:
>
> Hello,
> hard to figure out what is wrong without the error message..
> Cheers
> Thibaut
> ________________________________
> From: adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:
> adegenet-forum-bounces at lists.r-forge.r-project.org> [
> adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:
> adegenet-forum-bounces at lists.r-forge.r-project.org>] on behalf of Spencer
> Bruce [goatsrunfaster at gmail.com<mailto:goatsrunfaster at gmail.com>]
> Sent: 23 October 2014 15:29
> To: adegenet-forum at lists.r-forge.r-project.org<mailto:
> adegenet-forum at lists.r-forge.r-project.org>
> Subject: [adegenet-forum] repooling random rows from genind objects
>
> Hello All!
>
> I have three seperate populations as genind objects. What I would like to
> do is pull a certain number of random individuals from each, to form a new
> single genind population.
>
> I would then like individuals from this new genind population to mate
> randomly, producing another genind object which would contain their
> offspring.
>
> Below is the code I came up with (which does not work):
>
> Year1 <- repool(F1[sample(nrow(F1), 500), ], pop1[sample(nrow(pop1), 750),
> ], pop2[sample(nrow(pop2), 750), ], n=2000)
>
> Year2 <- hybridize(Year1[sample(nrow(Year1), 1000), ],
> Year1[sample(nrow(Year1), 1000), ], n=2000)
>
>
> any help would be greatly appreciated!
>
> Best,
> Spencer
>
> --
> Spencer A Bruce
> 200 Washington St.
> Troy, NY 12180
> 518 225 0787<tel:518%20225%200787>
>
>
>
> --
> Spencer A Bruce
> 200 Washington St.
> Troy, NY 12180
> 518 225 0787
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141023/2dfd9408/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 5
> Date: Thu, 23 Oct 2014 11:03:54 -0400
> From: Spencer Bruce <goatsrunfaster at gmail.com>
> To: "Jombart, Thibaut" <t.jombart at imperial.ac.uk>
> Cc: "adegenet-forum at lists.r-forge.r-project.org"
>         <adegenet-forum at lists.r-forge.r-project.org>
> Subject: Re: [adegenet-forum] repooling random rows from genind
>         objects
> Message-ID:
>         <
> CAGjKGeZiyS-27oF2CKb6JBPgS+VSyTA1-NS2Q8g2UC0JqOs4VA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> they both say Null, if I just type them into R.
>
> Just to be clear these genind objects contains microsat data for 11 loci
> for thousands of individuals.
>
> I'm rather new to R, so I apologize if I'm missing something obvious
> here...
>
> On Thu, Oct 23, 2014 at 10:54 AM, Jombart, Thibaut <
> t.jombart at imperial.ac.uk
> > wrote:
>
> >
> >
> >  What does nrow(F1) and other nrow(...)'s say?
> >
> >
> >
> >
> >   ------------------------------
> > *From:* Spencer Bruce [goatsrunfaster at gmail.com]
> > *Sent:* 23 October 2014 15:52
> > *To:* Jombart, Thibaut
> > *Cc:* adegenet-forum at lists.r-forge.r-project.org
> > *Subject:* Re: [adegenet-forum] repooling random rows from genind objects
> >
> >   Error message:
> >
> >  Error in sample.int(length(x), size, replace, prob) :
> >   invalid first argument
> >
> > On Thu, Oct 23, 2014 at 10:50 AM, Jombart, Thibaut <
> > t.jombart at imperial.ac.uk> wrote:
> >
> >>
> >> Hello,
> >> hard to figure out what is wrong without the error message..
> >> 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
> Spencer
> >> Bruce [goatsrunfaster at gmail.com]
> >> *Sent:* 23 October 2014 15:29
> >> *To:* adegenet-forum at lists.r-forge.r-project.org
> >> *Subject:* [adegenet-forum] repooling random rows from genind objects
> >>
> >>    Hello All!
> >>
> >>  I have three seperate populations as genind objects. What I would like
> >> to do is pull a certain number of random individuals from each, to form
> a
> >> new single genind population.
> >>
> >>  I would then like individuals from this new genind population to mate
> >> randomly, producing another genind object which would contain their
> >> offspring.
> >>
> >>  Below is the code I came up with (which does not work):
> >>
> >>  Year1 <- repool(F1[sample(nrow(F1), 500), ], pop1[sample(nrow(pop1),
> >> 750), ], pop2[sample(nrow(pop2), 750), ], n=2000)
> >>
> >>  Year2 <- hybridize(Year1[sample(nrow(Year1), 1000), ],
> >> Year1[sample(nrow(Year1), 1000), ], n=2000)
> >>
> >>
> >>  any help would be greatly appreciated!
> >>
> >>  Best,
> >> Spencer
> >>
> >>  --
> >> Spencer A Bruce
> >> 200 Washington St.
> >> Troy, NY 12180
> >> 518 225 0787
> >>
> >
> >
> >
> >  --
> > Spencer A Bruce
> > 200 Washington St.
> > Troy, NY 12180
> > 518 225 0787
> >
>
>
>
> --
> Spencer A Bruce
> 200 Washington St.
> Troy, NY 12180
> 518 225 0787
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141023/c51ccf09/attachment.html
> >
>
> ------------------------------
>
> _______________________________________________
> 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
>
> End of adegenet-forum Digest, Vol 74, Issue 9
> *********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20141023/e37fbbb8/attachment-0001.html>


More information about the adegenet-forum mailing list