Boxplot Darstellung fehlerhaft

Wie erstelle ich Grafiken, was ist zu beachten?

Moderatoren: EDi, jogo

Antworten
Sebastian85
Beiträge: 1
Registriert: Di Okt 22, 2024 9:37 pm

Boxplot Darstellung fehlerhaft

Beitrag von Sebastian85 »

Hallo,
ich habe folgendes Problem:
Mein Datensatz sieht wie folgt aus:

Code: Alles auswählen

data_area=
# A tibble: 7 × 6
  Cells Total comb       Cells_p      
      <dbl>  <dbl> <chr>      <chr>           
1        26    2048 Control D0 1.26953125      
2        64   5999 Control D0 1.06684447407901
3        74    797 Control D1 9.28481806775408
4       936    5281 Control D1 17.7239159250142
5       718    4783 Control D2 15.0114990591679
6       660    4518 Control D2 14.6082337317397
7       512    3839 Control D2 13.3368064600156
Ich habe einmal die Zellenanzahl als absolute Zahl (Cells) und einmal in Prozent (Cells_p).
Warum funktioniert ein ggplot Boxplot nur bei den absoluten Zahlen??

ggplot(data=data_area, aes(x=comb, y=Cells))+
geom_boxplot()
Absolut (Cells).JPG
Danke und Gruß

ggplot(data=data_area, aes(x=comb, y=Cells_p))+
geom_boxplot()
Prozentual (Cells_p).JPG
bigben
Beiträge: 2894
Registriert: Mi Okt 12, 2016 9:09 am

Re: Boxplot Darstellung fehlerhaft

Beitrag von bigben »

Hi!

Die Spalte Cells-p ist als Text <chr> markiert, nicht als Zahlenwet <dbl>. Versuch mal, die mit as.numeric() in ein Zahlenformat zu überführen.

LG,
Bernhard
---
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte
Antworten