我偶然发现了这个,我不知道发生了什么。谁能解释一下?
plot(iris$Petal.Length,iris$foobar)
产生此:
即使没有iris$foobar
,甚至没有foobar
对象。 y轴数据来自哪里?我在另一个data.frame上遇到了这个问题,所以这不是虹膜特有的(实际上,我在虹膜上尝试过,看看我的其他data.frame是否有毛病)。以及x轴如何标记为“索引”?
版本数据:
平台x86_64-w64-mingw32
拱形x86_64
os mingw32
系统x86_64,mingw32
状态
专业3
次要4.3
2017年
第11个月
第30天
svn rev 73796
语言R
version.string R版本3.4.3(2017-11-30)
昵称吃风筝的树
loadedNamespaces()
[1] "Rcpp" "HistData" "bindr" "magrittr"
[5] "grDevices" "tidyselect" "munsell" "wordcloud"
[9] "colorspace" "R6" "rlang" "stringr"
[13] "plyr" "dplyr" "tools" "utils"
[17] "grid" "gtable" "stats" "datasets"
[21] "yaml" "lazyeval" "assertthat" "tibble"
[25] "base" "bindrcpp" "purrr" "RColorBrewer"
[29] "ggplot2" "tidyr" "graphics" "glue"
[33] "slam" "stringi" "compiler" "pillar"
[37] "methods" "scales" "lubridate" "pkgconfig"
[41] "Cairo"
答案 0 :(得分:1)
d$foobar
被plot()
忽略,因为iris$foobar
是NULL
。
它只是在绘制花瓣的长度,在x轴上标有索引。
与plot(iris$Petal.Length)
或plot(iris$Petal.Length, NULL)
比较。
答案 1 :(得分:0)
在我看来,data.frame中似乎没有foobar,因为仅调用plot(iris$Petal.Length)
时会得到相同的图。由于第二个参数为空is.null(iris$foobar)
,因此它将被忽略。...