I am trying to use R to draw a chart.
library(readr)
library(dplyr)
library(tidyr)
library(ggplot2)
Ind <- read_csv("Industrial.csv")
Ind1 <- Ind %>%
select(Period,Year,City,Sub_Market,GeoLevel7,Property_Type,Average_Equivalent_Yield_Prime_Grade) %>%
filter(Sub_Market == "Sydney Metro" & GeoLevel7 == "South Sydney" & Property_Type == "Distribution Warehouse/Logistics")%>%
unite(Time,Period,Year,sep=".")
ggplot(data=Ind1, aes(x=Time, y=Average_Equivalent_Yield_Prime_Grade,group=1)) +
geom_line(color="#aa0022", size=1) +
geom_point(color="#aa0022", size=1) +
scale_x_discrete(breaks=c("Q1.1976","Q1.1981","Q1.1986","Q1.1991","Q1.1996","Q1.2001","Q1.2006","Q1.2011","Q1.2016","Q1F.2021","Q1F.2026")) +
ggtitle("South Sydney Cap Rates") +
labs(x="", y="(%)") +
theme(axis.title.y = element_text(size=12, family="Times", color="#666666")) +
theme(axis.text = element_text(size=12, family="Times")) +
theme(plot.title = element_text(size=14, family="Times", face="bold", hjust=0, color="#666666")
My issue is that the output is a chart that appears to repeat itself.
Screenshot of chart outcome
I am struggling to work out why this is happening. I have written the data table to a CSV file and have drawn it in Excel to get this result.
Excel Chart Screenshot
Some of the data is not available hence the broken lines in Excel, is this the cause of the R issue?
A sample of the Ind1 tibble is as below Image of Ind1 tibble. Sorry I am not sure how to insert a table or CSV file of the data.