data.frame
data <- data.frame(
type = c("BMW", "TOYOTA", "HONDA"),
NC = 100,
SC = 200,
NY = 150
)
Графика
library(ggplot) # Install first
library(data.table) # Install first
# Reshape data
data_melted <- melt(data, id.vars = "type")
# Now create the actual plot
ggplot(data_melted, aes(x = type, y = value, fill = variable)) +
geom_col(position = "dodge")
Результат
![enter image description here](https://i.stack.imgur.com/rh54T.png)