We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c1cc556 commit 4d833b8Copy full SHA for 4d833b8
nyc_data.R
@@ -98,6 +98,8 @@ colnames(dat)[1:2] <- c("Date", "PM25")
98
99
100
101
+
102
103
write.csv(dat, file = "nycdat.csv", row.names = F)
104
105
@@ -171,7 +173,22 @@ write.csv(mdls, file = "mdls.csv", row.names = F)
171
173
172
174
175
-
176
+#####
177
+# get avg %mdl for each source
178
+bdls <- 1 * (sweep(dat[, -1], 2, mdlmax, "<"))
179
+pbdls <- round(apply(bdls, 2, mean), 2)
180
181
+sour1 <- list()
182
+sour1[[1]] <- pbdls[c("aluminum", "calcium", "iron", "silicon", "titanium")]
183
+sour1[[2]] <- pbdls[c("sulfur", "ammonium_ion")]
184
+sour1[[3]] <- pbdls[c("OC", "elemental_carbon", "potassium")]
185
+sour1[[4]] <- pbdls[c("nickel", "vanadium", "nitrate",
186
+ "chlorine", "lead", "zinc")]
187
188
+meanmed <- function(x) {median(x, na.rm = T)}
189
+x <- sapply(sour1, meanmed)
190
+names(x) <- c("soil", "sec sulf", "traff", "resoil")
191
+x
192
193
194
0 commit comments