RStudio noob here

ggplot(data = Book1, aes(x = Rental Price (per sq metre))) + geom_histogram(binwidth = 5), fill = "green", colour = "green", alpha = 0.5) + ggtitle("Histogram of Rental Price") + ylab("Counts")

Error: unexpected symbol in "ggplot(data = Book1, aes(x = Rental Price"

Does anyone know what the error is and how to fix it?

your variable name includes spaces (and brackets) so the ggplot function wont know when one term starts and one term stops. to make ggplot see the variable name as one thing (a single variable name) put backticks around it.

`Rental Price (per sq metre)`

Ah thank you so much!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.