I am trying to run the rWBclimate package in RStudio. I copied the code below from ROpenSci and pasted it into RStudio. But I get the error "I don’t know how to automatically select the scale for the type list object. Default Error: geom_point requires the following missing aesthetic properties: y
gbr.dat.t <- get_ensemble_temp("GBR", "annualavg", 1900, 2100)
gbr.dat.t <- subset(gbr.dat.t, gbr.dat.t$percentile == 50)
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")
I also tried using geom_point (stat = "identity") as follows, but did not work:
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")
I still get the same message, “I don’t know how to automatically select the scale for a type list object. Error: geom_point requires the following missing aesthetic properties: y”
In addition, the result of str (gbr.dat.t) is shown below:
> 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" ...
Look for helpful answers.