Skip to content

Instantly share code, notes, and snippets.

@dainiuxt
Last active March 24, 2017 10:37
Show Gist options
  • Save dainiuxt/cd535cc413e7906842c4 to your computer and use it in GitHub Desktop.
Save dainiuxt/cd535cc413e7906842c4 to your computer and use it in GitHub Desktop.
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 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment