Ich möchte mehrere Faktorspalten (Lebensmittel und Gruppen) gleichzeitig sortieren/sortieren. Ich möchte alle nonCRISPR an der Spitze, und in der Nahrungsmittelspalte würde ich reguläres gefolgt von Nikotin innerhalb des nonCRISPR Ereignisses mögen. Das ist mein Code unten. Wenn ich über f1 bestelle, bekomme ich das Ergebnis unten, wenn ich f bestelle, bekomme ich alles regelmäßig gefolgt von Nikotin. Wie kann ich beides bekommen?So bestellen/sortieren Sie mehrere Faktor-Spalten im Datensatz
GenoSDs1<- aggregate(Viability ~ Line+Food+Group, x, sd);
f=factor(GenoSDs1$Food)
f1<-factor(GenoSDs1$Group)
levels(f) = rev(levels(f))
levels(f1) = rev(levels(f1))
GenoSDs1[order(GenoSDs1$Food, as.character(f1), decreasing = TRUE), ]
GenoSDs1
Line Food Group
33 11m3m Nicotine NonCRISPR
34 13f2m Nicotine NonCRISPR
35 13f5f Nicotine NonCRISPR
36 13m5f Nicotine NonCRISPR
37 1f1f Nicotine NonCRISPR
38 2f4f Nicotine NonCRISPR
39 3m5f Nicotine NonCRISPR
40 7f4m Nicotine NonCRISPR
41 11m3m Regular NonCRISPR
42 13f2m Regular NonCRISPR
43 13f5f Regular NonCRISPR
44 13m5f Regular NonCRISPR
45 1f1f Regular NonCRISPR
46 2f4f Regular NonCRISPR
47 3m5f Regular NonCRISPR
1 13f3f Nicotine CRISPR
2 13m2m Nicotine CRISPR
3 13m3f Nicotine CRISPR
4 13m4m Nicotine CRISPR
6 13f3f Regular CRISPR
7 13m2m Regular CRISPR
Das ist, was ich will.
Line Food Group
41 11m3m Regular NonCRISPR
42 13f2m Regular NonCRISPR
43 13f5f Regular NonCRISPR
44 13m5f Regular NonCRISPR
45 1f1f Regular NonCRISPR
46 2f4f Regular NonCRISPR
47 3m5f Regular NonCRISPR
48 7f4m Regular NonCRISPR
33 11m3m Nicotine NonCRISPR
34 13f2m Nicotine NonCRISPR
35 13f5f Nicotine NonCRISPR
36 13m5f Nicotine NonCRISPR
37 1f1f Nicotine NonCRISPR
38 2f4f Nicotine NonCRISPR
39 3m5f Nicotine NonCRISPR
40 7f4m Nicotine NonCRISPR
6 13f3f Regular CRISPR
7 13m2m Regular CRISPR
1 13f3f Nicotine CRISPR
2 13m2m Nicotine CRISPR
3 13m3f Nicotine CRISPR
4 13m4m Nicotine CRISPR
Das Problem sind die Spalten Faktoren sind – Genetics
sie Faktoren sein müssen, tun? GenoSDs1 [, 2] = as.character (GenoSDs1 [, 2]) – chrisamiller