I am attempting to make a scatter plot in ggplot with the variable "year" as the x axis and the variable "gdp" as the y axis. However, these two variables are not of equal length. I tried to fix this by omitting NA values but the lengths are still different. How do I proceed/equalize the length of each variable so that the plot can be made? Thanks in advance
mutate(nations,gdp=(gdp_percap*population)/1,000,000,000,000)
gdp
ggplot(na.omit(nations), aes(x= year, y = gdp)) +
geom_point()
Error: Aesthetics must be either length 1 or the same as the data (4303): y