Reputation: 3271
Sorry for puting this silly question: I am reading the book "Using R for Introductory Statistics" and would like to create a barplot using this data
install.packages("UsingR")
library(UsingR)
head(scrabble)
piece points frequency
1 A 1 9
4 B 3 2
7 C 3 2
10 D 2 4
The variable piece shows the letter, and the variable frequency its respective frequency in the scrabble game. Specifically, I would like to have on the X axis the letters, and on the Y axis the frequencies.
Thank you in advance
Upvotes: 2
Views: 2341
Reputation: 96976
Take a look at barplot()
, e.g.:
barplot(scrabble$frequency,
names = scrabble$piece,
xlab = "Piece",
ylab = "Frequency",
main = "Letter Frequencies")
To show all x-axis labels:
barplot(scrabble$frequency,
names = scrabble$piece,
xlab = "Piece",
ylab = "Frequency",
main = "Letter Frequencies",
las = 2,
cex.names = 0.5)
Upvotes: 7