0

So, I plotted this a while ago and it worked when I ran the code. However when I went to do it today it came up with the error message "Column x must be a 1d atomic vector or a list". I don't know why as it previously worked. Can anyone help with this? Code shown below. Any help greatly appreciated! Can't find the answer anywhere on this

pax = read.csv("pax.csv", header=TRUE, sep=",")

z <- read.csv("pax2.csv", header=TRUE, sep=",")

m <- data.frame(pax)

a <-data.frame(z)


graph2 <- ggplot (data=a, aes(x=day, y=pax)) +

    geom_area(stat="identity", fill="grey43") +

    #geom_line(data=m, aes(x=day,y=pax))+

    stat_function(fun = dnorm, args = list(mean = 0, sd = 1), aes(colour = 
    "Cumulative frequency distribution")) +

    stat_function(fun = dnorm, args = list(mean = 0, sd = .5),aes(colour = 
    "Distribution of pax per total journey time"))+

    scale_colour_manual("",values=c("grey50","black")) +

    theme ( axis.ticks=element_blank(), legend.position="right") +

    labs(fill="")

Image to show what graph should look like

Dan
  • 11,370
  • 4
  • 43
  • 68
  • Can you give a reproducible example? See e.g. https://stackoverflow.com/help/mcve – Matt Nolan Nov 23 '18 at 15:52
  • Could you make your problem reproducible by sharing a sample of your data so others can help (please do not use `str()`, `head()` or screenshot)? You can use the [`reprex`](https://reprex.tidyverse.org/articles/articles/magic-reprex.html) and [`datapasta`](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) packages to assist you with that. See also [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you?slide=5) & [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269) – Tung Nov 23 '18 at 18:56

0 Answers0