Description
在 R/GuitarPlot.R 中,aes() 调用直接引用了data frame的列名,这在ggplot2中是不推荐的做法:
# 第150行
p <- ggplot(densityCI, aes(x = densityCI$x)) # 不推荐
# 第151行
p <- p + geom_line(aes(y = density, colour = samples), ...)
# 第154-155行
p <- p + geom_line(aes(y = densityCI$confidenceDown, ...)) # 混合使用
p <- p + geom_line(aes(y = densityCI$confidenceUp, ...))
Impact
- ggplot2警告信息
- 代码风格不一致
- 可能在某些ggplot2版本中产生问题
Suggested Fix
统一使用列名而非 data$column 格式:
p <- ggplot(densityCI, aes(x = x))
p <- p + geom_line(aes(y = confidenceDown, colour = samples), ...)
p <- p + geom_line(aes(y = confidenceUp, colour = samples), ...)
File
R/GuitarPlot.R lines 150-159
Description
在
R/GuitarPlot.R中,aes()调用直接引用了data frame的列名,这在ggplot2中是不推荐的做法:Impact
Suggested Fix
统一使用列名而非
data$column格式:File
R/GuitarPlot.Rlines 150-159