# How to account for repeated measurements and unequal sample sizes in RDA

I have a question going in the same direction as this one: Restricted Permutations

However, I have a dataset of multiple Locations from which I have samples of sometimes 5 sometimes only 3 years. Not all locations were sampled in every year. I ended up having a dataset with observations e.g. several allel frequncies and a dataset with explanatory variables for every location. The second dataset contains information about soil characteristics, ownership of the fields and other agronomicaly relevant factors.

I want to use the second dataframe to explain the variance of my observations and came across RDA which seems appropriate. However, I don't know whether I can account for the repeated measures design in RDA or whether to use other statistical approaches in that regard.

I would like to control for the repeated measures design, while being aware of the missing data. I don't know whether this matters.

Second part of the question: I would like to do the analysis in R. Is the vegan package the best choice for this or are there alternative options? Also, do the observations need to be sorted by site within every year and do I need to put Location as a conditional factor? I know I can add conditional variables in RDA together with constrained variables but would it be sufficient to account for Year and Location as conditional variable?

I was approaching the problem with R and package vegan in the following way but is this the correct application?

rda("MyObservation"~"some-Constrained-Variables"+Condition("Location"+"Year"),"dataset")

• I'm voting to close this question as off-topic because it appears to be about appropriate syntax for using an R package. That would be off-topic here; please see advice in the Help Center on software-related questions. – Nick Cox Mar 25 '15 at 14:28
• Can you clarify if you are just asking if your code is right / how to correctly represent your situation in the code, or if you are asking about the statistical issues in this situation? If the latter, can you edit your Q to make its statistical aspects more prominent? – gung - Reinstate Monica Mar 25 '15 at 14:58
• Actually the question is about both topics with more emphasis on the statistical aspects. I will clarify the question. – user2386786 Mar 25 '15 at 15:01
• Thank you for clarifying your Q. FWIW, I think it is acceptable to have the R code in your Q. You may get some R help along w/ your answer. (To potential answerers: if you want to see the original R code, you can see it in the revision history.) – gung - Reinstate Monica Mar 25 '15 at 15:37