Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in membership.plot: Faceting variables must have at least one value #10

Open
D-A-Smith opened this issue Feb 18, 2020 · 2 comments

Comments

@D-A-Smith
Copy link

D-A-Smith commented Feb 18, 2020

Hi I'm getting an error when trying to produce a membership plot. Using the following code:

results1 <- file.path(outdir, paste0(analysis_name,"_Assign_kfold//"))

k.folds <- assign.kfold(assign, k.fold=c(2,3,4), train.loci=c(0.05, 0.1, 0.25, 0.5), 
             loci.sample="fst", model="svm", dir= results1)

accuKF <- accuracy.kfold(dir = results1)

accuracy.plot(accuKF, pop = c("all", "1", "2"))+
  annotate("segment",x=0.4,xend=3.6,y=0.33,yend=0.33,colour="red",size=1)

membership.plot(dir = results1, style = 2)

I get the error:
Error: Faceting variables must have at least one value

Which led me to the facet_grid() argument in ggplot.
Style = 1 or Style=3 work fine
The problem appears with both style =2 and =4, I suspect that ndf$origin.pop might be empty for some reason, but I'm not confident enough with how functions work to try anything else, sorry.

Deane.

R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

assignPOP_1.1.7

@D-A-Smith
Copy link
Author

Okay, I dug deeper, my populations were integers, eg. 1, 2 and 3. when I changed them to a, b and c, it worked fine.

@alexkychen
Copy link
Owner

Yea, that's the first thing I would try. Somehow the codes were not able to manage integers as population name. Will try to fix the bug in the future version. Thank you for your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants