Skip to content

Instantly share code, notes, and snippets.

@danielecook
Created May 4, 2020 12:11
Show Gist options
  • Save danielecook/51f89f309ef89bedd02cf68cebb1baf5 to your computer and use it in GitHub Desktop.
Save danielecook/51f89f309ef89bedd02cf68cebb1baf5 to your computer and use it in GitHub Desktop.
Chromosome order as a factor in R
# For chr_order with 'chr' prefix
# chr_order <- paste0("chr", c((1:22),"X","Y","M"))
chr_order <-c((1:22),"X","Y","M")
df$chrom <- factor(df$chrom, chr_order, ordered=TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment