I am following the examples lied out below (https://rpubs.com/thinh_ha/londonhouseprice). I am attempting to use the group by part.
by_pt <- select(df, realprice1, class) %>%
group_by(class) %>%
summarise(Count=n(), Mean.Price=mean(realprice1), St.Dev.Price=sd(realprice1), Median.Price=median(realprice1))
ggplot(melt(by_pt), aes(x=value, y=variable, fill=class)) +
facet_wrap(~ variable, scales='free') +
geom_bar(position="dodge", stat='identity', width=0.3)
The first part of my code creates a data frame called by_pt which has two rows and 5 columns. The first column is class which the first being Sole and the Second Joint. The remaining four are the stats creates in the summarise function.
However, when I use ggplot I get the following error.
Using class as id variables Error in match.names(clabs, names(xi)) : names do not match previous names
Can anyone explain why this is happening?