R: error in qplot from ggplot2: argument “env” is missing, with no default

后端 未结 2 1900
梦谈多话
梦谈多话 2021-01-17 12:42

I am using qplot from ggplot2 to plot the distances of seeds dispersed by different species in R. When I use geom=\'density\', it works just fine! But what I re

2条回答
  •  野的像风
    2021-01-17 12:55

    Regarding this error message it might help to point out that this is the error message you get when you use an empty data set for a histogram:

    df <- data.frame(testx = rnorm(0))
    p <- ggplot(df, aes(x=testx)) +
      geom_histogram()
    plot(p)
    
    Error in exists(name, envir = env, mode = mode) : 
      argument "env" is missing, with no default
    

    Unfortunately, the error message is not very helpful at all in this case. When I first ran into this problem it took me some time to figure out that I just accidentally had ended up with an empty data frame. The OP probably had a different problem, but it is always good to know that this error is connected to this stupid mistake.

提交回复
热议问题