[R] Barplot - Beginners Question

Jutta Wrage jw at witch.westfalen.de
Sun Oct 4 21:31:26 CEST 2015


Hi!

According to this I tried to create a barplot:

https://de.wikibooks.org/wiki/GNU_R:_barplot

Input Data (Tab delimeted)

Range   Anzahl  Prozent
36-40   12      1.92
41-45   21      3.36
46-50   48      7.68
51-55   87      13.92
56-60   92      14.72
61-65   131     20.96
66-70   67      10.72

I read the table using this command:
> datentabelle <- read.table( "stats-test.txt", header = TRUE, sep = "\t", dec = ".", row.names=1)
> datentabelle
      Anzahl Prozent
36-40     12    1.92
41-45     21    3.36
46-50     48    7.68
51-55     87   13.92
56-60     92   14.72
61-65    131   20.96
66-70     67   10.72
71-75     52    8.32
76-80     25    4.00
> is.data.frame(datentabelle)
[1] TRUE
>

Looking ate the table it looks like VADeaths

Then I try to plot as described in wikibooks

> barplot(datentabelle[,1], main= "Altersverteilung")

The plot I get looks lie that using VADeaths with one difference:
I do not ret the rownames in my table as labels for the bars

So what am I missing?

I expect something like I get from
> barplot(VADeaths[,1], main= "Altersverteilung")

Jutta



--
http://www.witch.westfalen.de

-------------- n?chster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 234 bytes
Beschreibung: Message signed with OpenPGP using GPGMail
URL         : <https://stat.ethz.ch/pipermail/r-help/attachments/20151004/ee568d85/attachment.bin>


More information about the R-help mailing list