【发布时间】:2015-04-05 17:05:00
【问题描述】:
我正在尝试在 RStudio 中运行 rWBclimate 包。我从ROpenSci 复制了以下代码并粘贴到 RStudio 中。但我收到错误消息“不知道如何为列表类型的对象自动选择比例。默认为连续 错误:geom_point 需要以下缺失的美学:y
gbr.dat.t <- get_ensemble_temp("GBR", "annualavg", 1900, 2100)
## Loading required package: rjson
### Subset to just the median percentile
gbr.dat.t <- subset(gbr.dat.t, gbr.dat.t$percentile == 50)
## Plot and note the past is the same for each scenario
ggplot(gbr.dat.t,aes(x=fromYear,y=data,group=scenario,colour=scenario))
+ geom_point() +
geom_path() +
theme_bw() +
xlab("Year") +
ylab("Annual Average Temperature in 20 year increments")
我也尝试通过以下方式使用 geom_point(stat="identity") 但没有奏效:
ggplot(gbr.dat.t,aes(x=fromYear,y=data,group=scenario,colour=scenario))
+ geom_point(stat="identity") +
geom_path() +
theme_bw() +
xlab("Year") +
ylab("Annual Average Temperature in 20 year increments")
我仍然收到相同的消息“不知道如何为列表类型的对象自动选择比例。默认为连续 错误:geom_point 需要以下缺失的美学:y"
另外,str(gbr.dat.t) 的结果如下:
> str(gbr.dat.t)
'data.frame': 12 obs. of 6 variables:
$ scenario : chr "past" "past" "past" "past" ...
$ fromYear : int 1920 1940 1960 1980 2020 2020 2040 2040 2060 2060 ...
$ toYear : int 1939 1959 1979 1999 2039 2039 2059 2059 2079 2079 ...
$ data :List of 12
..$ : num 9.01
..$ : num 9.16
..$ : num 9.05
..$ : num 9.36
..$ : num 10
..$ : num 9.47
..$ : num 9.92
..$ : num 10.7
..$ : num 10.3
..$ : num 11.4
..$ : num 12.1
..$ : num 10.4
$ percentile: int 50 50 50 50 50 50 50 50 50 50 ...
$ locator : chr "GBR" "GBR" "GBR" "GBR" ...
寻找有用的答案。
【问题讨论】:
-
请将
str(gbr.dat.t)的输出添加到您的问题中。