creating $samples for AMOVA from spreadsheet data

From: Patrick Kuss (
Date: Thu Oct 27 2005 - 18:34:17 MEST

  • Next message: Stéphane Dray: "Re: creating $samples for AMOVA from spreadsheet data"

    Good evening,

    I have been using R (ade4) and amova() to analyze my RAPD data from plants.
    Creating the adequate $distance and $structure df works fine. However I have a
    problem creating the $sample df from my original data.

    My data set looks something like this:

    region <- rep(c("east","west"),each=8)
    pop <- c(rep(1:4,each=4))
    ind <- c(rep(1:4,4))
    l.1 <- c(1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0)
    l.2 <- sample(c(0,1),16,replace=T)
    l.3 <- sample(c(0,1),16,replace=T)
    l.4 <- sample(c(0,1),16,replace=T)
    l.5 <- sample(c(0,1),16,replace=T)
    l.6 <- sample(c(0,1),16,replace=T)
    data <- data.frame(region,pop,ind,l.1,l.2,l.3,l.4,l.5,l.6)

    Creating the $samples df works fine that way

    pop <- as.factor(pop)
    samples <- + pop))
    names(samples) <- levels(pop)

    But if I subset my original dataset:

    data.short <- data[data$pop %in% c(1:3),]

    and try to create the $samples again I still get the original $samples output.

    pop <- as.factor(pop)
    samples <- + pop))
    names(samples) <- levels(pop)

    Any ideas how I can solve this? Additionally, how can I erase duplicate
    genotypes and note double presence in the $samples df?

    I am happy for any comments. Cheers


    Patrick Kuss
    Institute of Botany
    University of Basel
    Schönbeinstr. 6
    CH-4056 Basel
    +41 61 267 2976

    ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.

    This archive was generated by hypermail 2b30 : Thu Oct 27 2005 - 18:39:39 MEST