with_photon: Local photon instances

View source: R/new_photon.R

with_photonR Documentation

Local photon instances

Description

Evaluate R code with a photon instance without changing the active photon mount.

Usage

with_photon(photon, code)

Arguments

photon

An object of class photon that is temporarily mounted to the session.

code

Code to execute in the temporary environment.

Value

The results of the evaluation of the code argument.

Examples

# Get a public instance
pub_photon <- new_photon()

# Mount a custom instance
new_photon(url = "https://localhost:8001/")

# Geocode with the public instance only once
with_photon(pub_photon, geocode("Rutland"))

# The custom instance is still mounted
get_instance()

photon documentation built on April 10, 2026, 5:07 p.m.