Skip to content

Preserve factor level order when creating sample_data#406

Open
raivokolde wants to merge 2 commits intojoey711:masterfrom
raivokolde:master
Open

Preserve factor level order when creating sample_data#406
raivokolde wants to merge 2 commits intojoey711:masterfrom
raivokolde:master

Conversation

@raivokolde
Copy link

I just started using phyloseq and it is great! However, I was slightly annoyed that sample_data() changed the ordering of the factor levels. These play important role in drawing plots with ggplot2, so I decided to create a quick fix for the problem. There I drop unused levels but the order of remaining ones stays the same.

@joey711
Copy link
Owner

joey711 commented Apr 1, 2018

The better fix for this would be to use the canonical droplevels method:

https://stat.ethz.ch/R-manual/R-devel/library/base/html/droplevels.html

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

Successfully merging this pull request may close these issues.

2 participants