dainiuxt
7/30/2014 - 6:28 AM

## R trouble

R trouble

``````Problem solved. Faulty code in line 16: geom_line(aes(y = monthly\$CumOil, colour = "CumOil, 1000 m3"))

R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

Code:

library("ggplot2")
ggplot(monthly[monthly\$Well_N == "NSD1",],aes(Date_m)) +
geom_line(aes(y = QOM, colour = "Oil, m3/month")) +
geom_point(aes(y = QOM, colour = "Oil, m3/month")) +
geom_line(aes(y = QWM, colour = "Water, m3/month")) +
geom_line(aes(y = QFM, colour = "Liquid, m3/month")) +
geom_line(aes(y = WCT*10, colour = "WCT (1000=100%)")) +
geom_line(aes(y = monthly\$CumOil, colour = "CumOil, 1000 m3"))

Output:

> library("ggplot2")
> ggplot(monthly[monthly\$Well_N == "NSD1",],aes(Date_m)) +
+   geom_line(aes(y = QOM, colour = "Oil, m3/month")) +
+   geom_point(aes(y = QOM, colour = "Oil, m3/month")) +
+   geom_line(aes(y = QWM, colour = "Water, m3/month")) +
+   geom_line(aes(y = QFM, colour = "Liquid, m3/month")) +
+   geom_line(aes(y = WCT*10, colour = "WCT (1000=100%)")) +
+   geom_line(aes(y = monthly\$CumOil, colour = "CumOil, 1000 m3"))
Error: geom_line requires the following missing aesthetics: y

Data:

str(monthly)
'data.frame':	6150 obs. of  11 variables:
\$ Well_N: Factor w/ 93 levels "ABL2","ABL7",..: 21 21 21 21 21 17 21 17 21 17 ...
\$ Date_m: POSIXct, format: "2013-08-31" "2013-09-30" "2013-10-31" ...
\$ QOM   : num  0 0 0 0 0 0 0 0 0 0 ...
\$ QWM   : num  0 0 0 0 0 0 0 0 0 0 ...
\$ QOMT  : num  NA NA NA NA NA NA NA NA NA NA ...
\$ BHP   : num  NA NA NA NA NA NA NA NA NA NA ...
\$ PRES  : num  NA NA NA NA NA NA NA NA NA NA ...
\$ QIW   : num  12958 11920 12695 12461 13085 ...
\$ THPI  : num  NA NA NA NA NA NA NA NA NA NA ...
\$ QFM   : num  0 0 0 0 0 0 0 0 0 0 ...
\$ WCT   : num  0 0 0 0 0 0 0 0 0 0 ...``````