Thank Rainer and Jim!!

The end result was:
#Makes a new data set name "MyData_Minus_MW01" that contains all the data
where the Location Column is not equal to MW01 and the comma after that
ensures that all columns are copied into the amended data.frame.
MyData_Minus_MW01 <- MyData[ MyData$Location != "MW01", ]


The final code is as follows:

#Loads ggplot2
library(ggplot2)

#Loads data from internet and names it MyData
MyData <- read.csv( "http://doylesdartden.com/ExampleData.csv";, header =
TRUE, stringsAsFactors = FALSE )

#Makes a new data set name "MyData_Minus_MW01" that contains all the data
where the Location Column is not equal to MW01 and the comma after that
ensures that all columns are copied into the amended data.frame.
MyData_Minus_MW01 <- MyData[ MyData$Location != "MW01", ]

#Sets whic are detections and nondetects
MyData_Minus_MW01$Detections <- ifelse(MyData_Minus_MW01$D_GW_Elv ==1,
"Detected", "NonDetect")

#Removes the NAs
MyData_Minus_MW01WONA <-
MyData_Minus_MW01[!is.na(MyData_Minus_MW01$Detections),
]

#does the plot
p <- ggplot(data = MyData_Minus_MW01WONA, aes(x=Year, y=GW_Elv ,
col=Detections)) +
  geom_point(aes(shape=Detections)) +

  ##sets the colors
  scale_colour_manual(values=c("black","red")) + #scale_y_log10() +

  #location of the legend
  theme(legend.position=c("right")) +

  #sets the line color, type and size
  geom_line(colour="black", linetype="dotted", size=0.5) +
  ylab("Elevation Feet Mean Sea Level")

## does the graph using the Location IDs as the different Locations.
p + facet_grid(Location ~ .)


Thanks again
David

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to