diff --git a/R/build_targets.R b/R/build_targets.R index d9d804b..89cf266 100644 --- a/R/build_targets.R +++ b/R/build_targets.R @@ -19,18 +19,18 @@ #'@export #' build_targets <- function(table_schema, - table_description, - start_date, - end_date, - id_value, - description_string, - about_string, - about_title, - theme_title, - destination_path, - link_items, - thumbnail_link, - thumbnail_title + table_description, + start_date, + end_date, + id_value, + description_string, + about_string, + about_title, + theme_title, + destination_path, + link_items, + thumbnail_link, + thumbnail_title ){ # insitu_targets_link <- config$insitu_targets_file diff --git a/R/get_site_coords.R b/R/get_site_coords.R index 175781a..69dbce3 100644 --- a/R/get_site_coords.R +++ b/R/get_site_coords.R @@ -10,9 +10,15 @@ get_site_coords <- function(site_metadata, sites){ site_df <- readr::read_csv(site_metadata, col_types = cols()) - relevant_sites <- sites[which(sites %in% site_df$field_site_id)] + if ('site_id' %in% names(site_df) == FALSE){ + site_df <- site_df |> + rename(site_id = field_site_id) ## rename the neon site_id column + } - 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)])) + relevant_sites <- sites[which(sites %in% site_df$site_id)] + + site_lat_lon <- lapply(relevant_sites, function(i){c(site_df$longitude[which(site_df$site_id == i)], + site_df$latitude[which(site_df$site_id == i)])}) return(site_lat_lon) }