<div>Hi All</div><div> </div><div>Further to this post, i tried giving all the individuals in the dataset a unique value before</div><div>importing as a geniod object in R, i then used the same code as below.</div><div> This still had the same effect at the end:</div>
<div> </div><div>> m.dapc <- dapc(m.pca, grp=pop(M))<br>Choose the number PCs to retain (>=1): 23<br>Error in `row.names<-.data.frame`(`*tmp*`, value = c("Axis1", "Axis2", : <br> invalid 'row.names' length<br>
</div><div>I tired on a friends Mac OS computer last night with the latest version of all packages</div><div>installed from CRAN and it still didnt work? This code worked in the past on older versions</div><div>of R and adegenet, im wondering if this is where the issue might lie?</div>
<div> </div><div>Has anyone tried running an (unedited) Genpop file with the below commands in the new versions, im</div><div>interested to see if they can reproduce the errors i have.</div><div> </div><div>cheers</div><div>
Martin</div><div> </div><div><br>Martin van der Meer<br>PhD candidate<br>Molecular Ecology and Evolutionary Laboratory<br>Australian Tropical Sciences and Innovation Precinct</div><div>School of Marine and Tropical Biology<br>
James Cook University<br>Townsville<br>Australia</div><div><br> </div><div class="gmail_quote">On 19 September 2011 13:25, Martin van der Meer <span dir="ltr"><<a href="mailto:martinhvandermeer@gmail.com">martinhvandermeer@gmail.com</a>></span> wrote:<br>
<blockquote style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;" class="gmail_quote"><div>Hi All</div><div> </div><div>Ive had to switch to a PC (Windows Vista) since the Mac OS system crashed. Ive installed R with all</div>
<div>the packages for running DAPC (ade4, Adegenet, MASS). I use the same command codes that i</div>
<div>used for R in the Mac OS. I have not changed the directories from where R was loaded and </div><div>all packages and R are the latest version. My file format is in Genepop. I have tried a vraiety of</div><div>methods including importing as a table and using read.table, giving individual numbers in the genepop file,</div>
<div> i have run R as an administrator, etc all to no avail. This is incredibely frustrating as it works without flaw </div><div>in the Mac OS. Any help would be appreciated. Here is the code im using for R:</div><div> </div>
<div> </div><div> </div><div>> read.genepop("Aa.gen") -> M</div><div> Converting data from a Genepop .gen file to a genind object... </div><div><br>File description: Title line:"Aa" </div><div>
...done.</div>
<div>> M1 <- scaleGen(M, missing="mean")</div><div>Pop1 Pop2 Pop3 Pop4 Pop5 <br> 14 20 24 28 33 <br>Warning message:<br>In validityMethod(object) : <br>duplicate names in ind.names:</div><div>> m.pca <- dudi.pca(M1, center=FALSE, scale=FALSE, scannf=FALSE, nf=100)<br>
Error in `row.names<-.data.frame`(`*tmp*`, value = c("Pop1", "Pop1", "Pop1", : <br> duplicate 'row.names' are not allowed<br>In addition: Warning message:<br>non-unique values when setting 'row.names': ‘Pop1’, ‘Pop2’, ‘Pop3’, ‘Pop4’, ‘Pop5’ <br>
> uniquewt.df(M1)-> M2<br>Warning message:<br>In data.row.names(row.names, rowsi, i) :<br> some row.names duplicated: 2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119 --> row.names NOT used<br>
> m.pca <- dudi.pca(M2, center=FALSE, scale=FALSE, scannf=FALSE, nf=100)<br>> barplot(m.pca$eig, main="eigen")<br>> temp <- cumsum(m.pca$eig)/sum(m.pca$eig)<br>> plot(temp, xlab="addedpc", ylab="totgenet")<br>
> min(which(temp > 0.95))<br>[1] 92<br>> axis(1, at = 92, lab = 92)<br>> segments(92, 0, 92, temp[92], col = "red")<br>> segments(-5, 0.95, 92, 0.95, col = "red")<br>> s.class(m.pca$li, M$pop, lab= M$pop.names, sub="PCA 1-2", csub= 2)<br>
> add.scatter.eig(m.pca$eig[1:20], nf = 3, xax = 1, yax = 2, posi = "bottom")<br>> m.lda <- lda(m.pca$li[, 1:92], grouping=pop(M))<br>> names(m.lda)<br>[1] "prior" "counts" "means" "scaling" "lev" "svd" "N" "call" <br>
> m.pred <- predict(m.lda)<br>> m.pred$class<br> [1] Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop1 Pop2 Pop2 Pop2 Pop2 Pop2<br> [20] Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop2 Pop3 Pop3 Pop3 Pop3<br>
[39] Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3 Pop3<br> [58] Pop3 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4<br> [77] Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop4 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5<br>
[96] Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5 Pop5<br>[115] Pop5 Pop5 Pop5 Pop5 Pop5<br>Levels: Pop1 Pop2 Pop3 Pop4 Pop5<br>> head(m.pred$posterior[, 1:5])<br> Pop1 Pop2 Pop3 Pop4 Pop5<br>
1 1 4.177827e-31 1.917492e-27 1.506373e-34 7.272060e-35<br>2 1 4.848692e-28 9.903303e-25 2.649258e-33 4.010207e-35<br>3 1 4.937353e-20 5.195535e-16 1.195006e-19 2.183740e-24<br>4 1 4.608358e-19 1.503307e-15 7.937646e-22 5.661887e-24<br>
5 1 1.225733e-27 2.661842e-20 6.963585e-34 2.458251e-36<br>6 1 3.344632e-15 2.383149e-18 1.608183e-26 7.585079e-31<br>> mean(m.pred$class==pop(M))<br>[1] 1<br>> misAs <-tapply(m.pred$class !=pop(M), pop(M), mean)<br>
> barplot(misAs, xlab="populations", ylab= "% of missassignments per pop", col="orange", las=3)<br>> table.paint(head(m.pred$posterior, 119, col.lab= paste("population", 1:5, sep=".")))<br>
> m.dapc <- dapc(m.pca, grp=pop(M))<br>Choose the number PCs to retain (>=1): 23<br>Error in `row.names<-.data.frame`(`*tmp*`, value = c("Axis1", "Axis2", : <br> invalid 'row.names' length<br>
<br clear="all"><br>-- <br></div><font color="#888888"><div>Martin van der Meer<br>PhD candidate<br>Molecular Ecology and Evolutionary Laboratory<br>Australian Tropical Sciences and Innovation Precinct</div>
<div>School of Marine and Tropical Biology<br>James Cook University<br>Townsville<br>Australia</div><br>
</font></blockquote></div><br><br clear="all"><br>-- <br><div>Martin van der Meer<br>PhD candidate<br>Molecular Ecology and Evolutionary Laboratory<br>Australian Tropical Sciences and Innovation Precinct</div>
<div>School of Marine and Tropical Biology<br>James Cook University<br>Townsville<br>Australia</div><br>