From 7ebe52f534e228b778994fa672c08d04d7fca979 Mon Sep 17 00:00:00 2001 From: Andrew Gene Brown Date: Sat, 17 Jun 2023 15:44:38 -0700 Subject: [PATCH] Assign only if exists for #9 --- R/gpkg-connection.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/gpkg-connection.R b/R/gpkg-connection.R index e123162..810809b 100644 --- a/R/gpkg-connection.R +++ b/R/gpkg-connection.R @@ -19,7 +19,12 @@ gpkg_connect.geopackage <- function(x) { obj <- as.character(substitute(x)) x$con <- gpkg_connect(x$dsn)$con # update object in parent frame - try(assign(obj, x, envir = parent.frame())) + for (o in obj) { + if (exists(o, envir = parent.frame())) { + try(assign(o, x, envir = parent.frame())) + break + } + } x }