# Metal concentrations in lake sediments

## Question

What are metal concentrations in lake sediments? The focus is on Finland.

#### 1) Calculate the metal concentration based on the mean value of the surrounding lakes (spherical area specified by radius)

 Select metal:Co Cr Cu Fe Mn Ni Pb S V Zn ```library(OpasnetBaseUtils) library(xtable) library(ggplot2) data <- tidy(op_baseGetData("opasnet_base", "Op_en5462")) out <- data[data\$Observation %in% metalli, ] colnames(out) <- c("DateTime", "TagName", "Value") out\$Value <- as.numeric(out\$Value) out\$DateTime <- as.numeric(out\$DateTime) cat(paste("Metalli: ", metalli, "\n", sep="")) plot(out\$Value) ```

 Northing:Easting:Give radius (km; lakes inside that area are taken into account):Select metals:Co Cr Cu Fe Mn Ni Pb S V Zn ``` library(OpasnetBaseUtils) library(xtable) library(ggplot2) library(reshape) data <- (op_baseGetData("opasnet_base", "Op_en5462")) data <- tidy(data) data\$Result <- as.numeric(data\$Result) # This replaces all as.numeric rows below. data <- reshape(data, timevar = "Observation", idvar = "ID", direction = "wide") colnames(data) <- gsub("Result.", "", colnames(data)) data\$distance <- sqrt((as.numeric(data\$Easting) - easting)^2 + (as.numeric(data\$Northing) - northing)^2) data <- melt(data, measure.vars = c("Co", "Cr", "Cu", "Fe", "Mn", "Ni", "Pb", "S", "V", "Zn")) out <- data out\$distance <- data\$distance <= säde*1000 out <- as.data.frame(as.table(tapply(out\$value, out[c("variable", "distance")], mean))) colnames(out) <- gsub("variable", "metalli", colnames(out)) colnames(out) <- gsub("Freq", "pitoisuus", colnames(out)) cat("Metallipitoisuuden keskiarvo ", säde, " km säteellä pisteestä ", easting, "E, ", northing, " N.\n") print(xtable(out[out\$distance == TRUE, ]), type = 'html') cat("Pitoisuudet metallille", metalli, ".\n") concentration <- data[data\$distance <= säde*1000 & data\$variable == metalli, "value"] plot(concentration) # simple plot about concentrations. qplot(Easting, Northing, data = data[data\$variable == metalli, ], size = value) # Concentrations on a "map". ```

#### 2) Calculate metal concentration based on the concentration of a big lake

 Select the metals: Co Cr Cu Fe Mn Ni Pb S V Zn Name of the big lake:Coefficient for pH:Coefficient for land use:```library(OpasnetBaseUtils) n <- 1 data <- tidy(op_baseGetData("opasnet_base", "Op_en5462")) temp <- data[data\$Observation == "Järvi", ] temp <- temp[temp\$Result == name, "ID"] data <- data[data\$ID == temp & data\$Observation %in% metalli, ] conc <- make.ovariable(data) conc <- conc * coeff.pH * coeff.landuse conc@sample library(xtable) print(xtable(conc@sample), type = 'html') ```

## Rationale

Based on data from GTK, Finland. Data structure (not content) was updated based on this code: . Old code does not work any more until it is simplified.