From 8490da6bc892fc244e58dd5a7500c56861ba005d Mon Sep 17 00:00:00 2001 From: addelany Date: Tue, 30 Apr 2024 11:41:49 -0500 Subject: [PATCH] only use sites included in metadata --- R/get_site_coords.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/get_site_coords.R b/R/get_site_coords.R index 111f49e..175781a 100644 --- a/R/get_site_coords.R +++ b/R/get_site_coords.R @@ -10,7 +10,9 @@ get_site_coords <- function(site_metadata, sites){ site_df <- readr::read_csv(site_metadata, col_types = cols()) - site_lat_lon <- lapply(sites, function(i) c(site_df$longitude[which(site_df[,2] == i)], site_df$latitude[which(site_df[,2] == i)])) + relevant_sites <- sites[which(sites %in% site_df$field_site_id)] + + site_lat_lon <- lapply(relevant_sites, function(i) c(site_df$longitude[which(site_df[,2] == i)], site_df$latitude[which(site_df[,2] == i)])) return(site_lat_lon) }