I have a table given below
PSR exon
3311421 E11
3311422 E11
3311423 E11
3311424 E11
3311427 E10
3311428 E9
3311429 E8
3311431 E7
3311432 E7
3311433 E7
3311434 E7
3311436 E6
3311441 E5
3311442 E4
3311445 I4
3311446 I4
3311447 I4
I’m trying to custom order them based on
custom = c("E4","I4","I4","I4","E5","E6","E7","E7","E7","E7","E8","E9","E10","E11","E11","E11","E11")
I tried using
df <- within(df, exon <- factor(exon, levels = custom))
It says
“warning message: In
levels<-(*tmp*, value = c(“E4”, “I4”, “I4”,
“I4”, “E5”, “E6”, : duplicated levels will not be allowed in
factors anymore
Is there anyway I could do this?
You should probably follow the instructions in the warning, and make your list of factor levels unique, but in the desired order. One quick way would be: