
域分析のためのRコード:静的GTFSからのGeoJSON自動変換と即時アニメーション可視化 概要(Description) 1. バージョン4.1リリースノート:時空間GeoPackageの統合 今回のアップデートでは、公式GTFSデータの公開・更新が実質的に停止している阿久比町コミュニティバスを網羅し、4自治体にまたがる広域バス運行シミュレーションを実現した。このシミュレーターの基盤となる時空間GeoPackageデータを、生のデータソースから一括生成する専用の変換コードを新たに作成した。同期化された運行ダイヤ情報は、生成された単一のGeoPackageファイル内にある点(停留所)レイヤーの属性テーブルへと直接記録されている。これに加え、ルート線形データ(shapes)の欠落を視覚的に克服するパルス明滅型(点描仕様)の表現を採用したことで、起動時における生のGTFS処理負荷(オーバーヘッド)が排除され、公式のGTFSが提供されていない地域も統一的に一貫性のあるWebシミュレーターを、制限のあるクラウド環境上でも軽快に起動することが可能となった。 デモ https://moteki.shinyapps.io/chita_transit4/ 2. QGISフィールド計算機を用いた時系列フィールドの生成 GTFSデータ等から出力したgpkgファイルは、QGIS等でも表示できる。時間軸に連動したアニメーションを開始するには、QGISの「フィールド計算機(そろばんのアイコン)」を開き、新しいタイムスタンプ属性を作成する。この設定における絶対的な鍵(キモ)は、「新しいフィールドをつくる」にチェックを入れ、出力フィールド名に「bus_time」と入力し、出力するフィールド型を「日時 (Date/Time)」に指定することである。そして、式のボックスに数式 to_datetime('2026-06-06 00:00:00') + make_interval(minutes:= "time_min") を正確に入力する必要がある。この重要な数式がシミュレーション全体の技術的エンジンとして機能し、整数ベースの経過分数を、GISのネイティブな空間タイムラインへと動的に変換する。 3. 主要地理空間出力ファイルの仕様(Version 4.1) combined_bus_routes.gpkg (479.2 kB) すべての運行主体の静的な路線網ジオメトリ(形状)およびルート線形を統合した地理空間「線(ライン)」データセットであり、構造的な背景地図レイヤーとして機能する。 combined_bus_stops.gpkg (6.1 MB) すべてのバス停留所に時刻表ダイヤ(発着分数)をあらかじめ組み込んだ時空間「点(ポイント)」データセットであり、実行時に生のGTFSを処理することなく、完全に同期された瞬間的なパルス明滅アニメーションを駆動させる。 本プログラムの目的および概要(V3.8-3.9機能) 本プログラム(最新V3.8)は、入手容易な「静的GTFS(Static GTFS)データ」を作業フォルダに投入するだけで、広域公共交通ネットワークの運行ダイナミズムを誰もが即座に再現・視覚化できる、極めて実用的で扱いやすい軽量データサイエンス・パッケージである 。 最大の特徴は、複雑なデータ処理をすべて裏側に隠し、以下のプロセスを全自動化した点にある 。 全自動コンバート機能: フォルダ内のGTFSデータから、路線網の「線データ」と、1分刻みのバス位置の「点データ」という2つの標準GeoJSONファイルを全自動で生成 。 高機能スムーズ・ビューワー: 生成されたGeoJSONをR(Shiny/Leaflet)に読み込ませるだけで、バスオブジェクトが道路上を滑らかに走り出す動的シミュレーターを同梱 。 時差バグの根絶: R環境で頻発しやすい「時間が9時間ズレて車両が画面から消失する時差バグ」を防止 。 本システムは、高価なリアルタイムデータ(GTFS-RT)インフラに依存せず、国内標準規格「GTFS-JP」等の既存データのみで、主要駅や病院などの結節点における接続性やルート間の関係を客観的に検証できる、政策科学の実践的な軽量プラットフォームとして機能する 。本コードは、Google Geminiのコード支援を用い、実装した。 Web上でのShinyアプリの公開(試用版) 本研究で構築したデータセットおよび前処理パイプラインの有用性を実証するため、ブラウザ上で動作するインタラクティブな時空間シミュレーター(デモ版)をhttps://policyevaluation.net/transit/ このデモ版は契約するサーバーの都合で、一時的にアプリへアクセスできなくなる(接続エラー画面が表示される)可能性がある。その場合は、本リポジトリからデータおよびコードをローカル環境にダウンロードして実行してください。 別サーバーでのデモ https://moteki.shinyapps.io/transit/ (260527追記)V3.9でGTFSや運行情報データを独自に生成した阿久比町「アグピー号」の運行シミレーションも含めた知多地域の3市町のシミュレーターをデモ公開しました。(260528追記)オレンジラインのピアゴのあたりから川に沿って西に路線が延びている部分に、路線が正確でない箇所を確認し、正確に描く方法を検討しています。 V4.0更新 知多半島の4事業者版公開(東浦町、知多市、大府市) (260530追記)GTFSの提供している大府市のふれあいバスを対象に含めた知多半島の4事業者版を公開しました。https://moteki.shinyapps.io/transit_chita/。(260530追記2)4事業者版のレンタルサーバー環境での稼働もコード変更で実現しました。https://www.policyevaluation.net/transit_chita/ *この後者のサーバーは仕様変更で、現在不安定。 V3.9へのアップデート(時刻表データ・バス停データからのGTFSの生成) 本研究で構築したV3.8までのフレームワークでは、静的GTFSデータからGeoJSONへの自動変換および可視化プロセスの基盤を確立した。 続くV3.9においては、その成果をさらに発展させた。今回分析対象とする阿久比町は、これまでの分析対象であった東浦町の南側に隣接する地域である。この阿久比町において、公式GTFSデータの公開が終了するという課題が発生したため、独自のデータ再構築プロセスを実装することで、持続可能な分析基盤を再構築した。具体的には、阿久比町の公式ウェブサイト上で公開されているバス停情報および時刻表情報(https://www.town.agui.lg.jp/0000005531.html, https://www.town.agui.lg.jp/0000005530.html)を直接のソースとし、これらを標準的なGTFSフォーマットへ変換する専用コンバーターを開発した。 これにより、公式データの消失後も地域公共交通の動態分析を継続可能とし、いわば『デジタル公共交通データの再生』を実現している。さらに、系統ごとのオフセット処理を最適化することで、路線図の重なりを回避し、より直感的に運行系統を識別できる視覚的表現を実装した。本バージョンにより、分析環境としての再現性と精度が大幅に向上し、東浦町との比較分析など、地域間を跨いだ公共交通の現状をより客観的に提示可能な分析パッケージへと進化させた。 2. 開発の背景と空間統合のステップアップ(V3.5~V3.7からの進化) 本手法の構築にあたっては、中島円(2025)『GIS入門 この一冊で「統計マップ」が自在に作れる』(ベレ出版)第7章「バスの流線図の作成」における、QGISを用いた静的GTFSデータの可視化プロセスから大きな着想を得ている 。本システムは、この静的構造理解を基礎としつつ、RおよびShinyによる動的な時系列シミュレーションへと独自に進化を遂げてきた 。 最新のV3.8は、先行して公開された各バージョンの高度な空間統合ロジックをすべて継承している 。 V3.5(単一自治体モデル): 東浦町のコミュニティバス「う・ら・ら」を対象に、静的計画データから動的シミュレーションを逆生成する独自のアーキテクチャを確立 。 V3.6(多事業者・空間統合モデル): 知多市を主たるモデルとし、民間一般路線(知多バス)と生活交通(あいあいバス)という運行主体の異なる二層構造の交通網を同一画面上に統合 。 V3.7 / V3.8(広域境界結節モデルへの高度化): 単一自治体の枠組みを越えて愛知県知多市・知多郡東浦町の2自治体(3事業者:あいあいバス、う・ら・ら、知多バス)へと空間スケールを完全に拡大・統合 。R/Shinyによる「動的な時空間線形補間エンジン」により、巽ヶ丘駅周辺や森岡地区など、複雑に交錯する広域結節点での運行ダイナミクスを完全同期可視化するアルゴリズムを確立した 。さらに、ビジュアルマネジメントの観点から「路線固有色×車両コーポレートカラー3色固定」のハイブリッド色彩制御を新たに導入し、画面キャプチャ・録画の効率を最大化する下部スライダーUIへと刷新している 。 3. 先行事例(gtfs-box等)との違いおよび本プログラムの独自性 GTFSデータを活用した動的公共交通シミュレーションという点において、本プログラムは優れた先行事例である「gtfs-box」(https://github.com/nagix/gtfs-box)等と共通の着想を持つが 、実務・教育現場における「圧倒的な簡便性」とデータサイエンス環境への最適化において、決定的な優位性を有する 。 (1) 圧倒的な簡便性(インフラフリー・単一スクリプト完結) JavaScriptやWebサーバーの高度な知識・環境構築を必要とする一般的なWebアプリケーションに対し、本プログラムは必要なGTFSテキストファイルを作業フォルダに配置し、Rスクリプトを実行するだけで即座に動作する 。専門のインフラや複雑な設定を一切排除したこの簡便性は、自治体の交通政策実務や、大学のワークショップ等の限られた時間内でツールを即座に導入・活用する上で決定的な優位性となる 。 (2) データサイエンス環境(R言語/Shiny)へのダイレクトな最適化 地域分析や空間統計(GIS)の標準言語であるR(shiny, leaflet, tidyverse, sf)のみで完結しているため、利用者は内部ロジック(線形補間など)を直接確認・編集できる 。さらに、出力された車両動態データをそのままRでの統計解析や他の地域分析ロジックへとシームレスに結合・拡張させることが可能である 。 (3) 地域公共交通網全体の網羅的な一括可視化(常時色分け描画) 単一の事業者や特定の路線のみを個別に切り取る既存アプローチとは異なり、アプリ起動時から全系統の路線網および動的に移動するバスの車両オブジェクト(点マーカー)自体が、それぞれの運行系統に対応した固有のルートカラーで常時描画される 。これにより、複数の系統や車両が街の中でどのように重複し、どこで結節やすれ違いを行っているかという「地域全体の交通デザイン」を高次元な政策的視点から直感的に把握できる 。 4. 国際的文脈における位置づけ:動的アクセシビリティ評価の設計思想 本コードの設計思想は、国際的文脈において、英国ウェールズの研究グループ(Webb et al., 2025)が提案した動的なアクセシビリティ評価ツールの設計思想と強く通底するものである 。 Webb, L., Langford, M., Higgs, G., & Berry, R. (2025). The design of a dynamic web-based solution to measure accessibility via public transport under different travel scenarios. Case Studies on Transport Policy, 21, 101561. Webb et al.(2025)は、バス路線の廃止・新設や事業者の撤退といった移動シナリオが公共交通のアクセシビリティに与える影響を、政策立案者が動的に分析・比較できるインタラクティブなWeb-GISツールを提案している 。 本コードの独自性:複雑なインフラを排した「簡便な実装」 バス停の配置やルートの変更が地域に与える影響をシミュレーションし、科学的政策形成(EBPM)に資する視覚的根拠を得るという目的はWebbらの論文と軌を一にしている 。しかし、実装アプローチにおいては以下の決定的な違いを有する 。 インフラフリーの追求: WebbらのシステムがバックエンドにPostgreSQL/PostGIS、OpenTripPlanner、GeoServer、PHPといった多層的なサーバーサイド・インフラを要求する「重厚な設計」であるのに対し、本コードはR言語の標準的な環境(デスクトップ・ノートPC)のみで動作する「簡便な実装」を追求している 。 現場への適応性: 重厚なインフラを排したことで、専門的なITスキルのない行政担当者や、制約の多いワークショップ現場、プログラミング教育の現場においても、GTFSデータさえあれば即座にシナリオ検討を開始できる高い機動性を確保している 。 5. 関連バージョンの案内 Version 2.0(静的流線図マッピング版): GTFS-JPデータを用いた、よりシンプルで静的な可視化(インフラの流線図マッピングなど)を希望される利用者のためのレガシー版 。 Moteki, Y. (2026). R Code for Regional Analysis: Interactive Flow Mapping of Public Transport Infrastructure using Leaflet and GTFS Data (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20116368 GTFS-Realtime 統合フレームワーク(関連リポジトリ): 実際のリアルタイムデータ(GTFS-Realtime)フィードを活用した統合的な可視化フレームワーク。都営バス、知多市「あいあいバス」、広島電鉄バスなどの具体的な実装事例を確認したい利用者向け 。 Moteki, Y. (2026). R Code for Regional Analysis: Integrated GTFS-Static and Realtime Public Transit Data Visualization Framework (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20278677 2. データ出典および作成者 6. 学術的・実務的価値 本スクリプトにおける空間的な正確性およびルーティング(経路生成)ロジックは、東浦町地域公共交通会議が発行する『楽しい公共交通のはじめかた』に掲載された「公共交通ざっくりマップ」と照合・検証済みである(初期のV1.0開発段階においてデータ整合性を確認)。 本パッケージは、他の地方自治体や交通研究者、そして学生が「手元にある生のGTFSフィードを即座に地図へと変換し、自らの目で実際の運行パターンを実証的に理解・検討するための、極めて汎用性の高い即用型(ターンキー)のベースライン・プラットフォームを提供する。さらに、本アプリケーションで描写される各路線のレンダリングカラー(描画色)は、生のGTFSデータ内部に埋め込まれたカラーコード(16進数カラーコード)から直接パース(抽出)されており、公式の「公共交通ざっくりマップ」の配色と完全に同期・連動している。 7. 注意事項:アプリケーションの安全な停止とRセッションの再起動 コード修正時、変更内容を画面に確実に反映させ、メモリ残存による誤作動を防ぐためには、「プログラムの停止」と「Rセッションの再起動」の2ステップを踏むのが最も安全である。 (1) 稼働中アプリケーションの停止(コンソールの解放) コードを書き換える前に、必ずRStudioのコンソール右上(またはViewer枠内)にある「赤い停止マーク(ストップボタン)」を押し、アプリを明示的に停止させる。 ブラウザのウィンドウを閉じるだけでは、裏側でローカルウェブサーバーのプロセスが未終了のまま残存し、次回起動時にポート(通信の接続口)の衝突エラーを起こすリスクがある。停止マークを押すことでプロセスが安全にシャットダウンされ、占有されていたコンソールが解放される。 (2) Rセッションの再起動(メモリの完全初期化) アプリ停止後、RStudioのメニューバーから Session ➔ Restart R (ショートカットキー: Ctrl + Shift + F10 / Macは Cmd + Shift + F10)を実行し、Rのセッションを完全に初期化する。 本スクリプトのように事前に大量のGTFSデータをメモリに展開する構造では、古いオブジェクトや関数のキャッシュが残りやすい。再起動によりメモリが完全にクリアされ、修正後の最新UIパラメータやロジックが100%クリーンな状態で読み込まれる。 [English] R Code for Regional Analysis: Multi-Operator GTFS Integration, Automated Spatiotemporal Conversion, and Lightweight Pulse Animation (v4.1) 1. Purpose and Regional Scope: The Milestone of V4.0 This data science package encapsulates a lightweight, high-performance geospatial framework engineered to synchronize, analyze, and visualize the dynamic operations of regional public transit networks across municipal borders. The publication of Version 4.0 marked a major milestone by expanding the analytical scale to a 4-operator, regional integration model across the Chita Peninsula, Aichi Prefecture. It successfully consolidated a highly fragmented public transit environment under a single timeline: Chita City: Regional commercial trunk lines (Chita Bus) and municipal local service (Aiai Bus). Higashiura Town: Community transit lines (U-ra-ra). Obu City: Community local loops (Fureai Bus), incorporating newly deployed static GTFS feeds. Agui Town: Local community loops (Agupi-go). By synthesizing these diverse datasets, the V4.0 framework established an agile platform for Evidence-Based Policy Making (EBPM), allowing policymakers, transport planners, and researchers to audit cross-boundary connectivity and inter-route dependencies at critical regional hub nodes. 2. Technical and Visual Resolution in Version 4.1 While V4.0 achieved broad territorial integration, it exposed a pervasive real-world challenge: institutional data friction and structural data gaps. In the case of Agui Town, official GTFS feeds are hindered by restrictive administrative gatekeeping—requiring approval-based credentialing to obtain access IDs—while updates on public platform systems have stagnated. Consequently, researchers must contend with severe data fragmentation, including a complete absence of official spatial track geometry lines (shapes.txt). Version 4.1 delivers the definitive technical and visual resolution to these constraints through a two-fold architectural breakthrough: Decoupled Spatiotemporal Data Architecture: Instead of processing raw, disparate GTFS text feeds at runtime, V4.1 introduces a highly optimized pipeline that pre-embeds complex transit schedules directly into the attribute fields of a standardized GeoPackage point layer. This completely eliminates runtime parsing overhead, enabling interactive web application servers to launch instantaneously without active runtime or memory bottlenecks. Spatiotemporal Pulse-Emissive (Point-Based) Visualization Paradigm: To seamlessly circumvent missing route alignment tracks without distorting underlying schedule veracity, V4.1 shifts from traditional continuous line-routing animations to a point-based pulse-emissive rendering model. By mapping discrete vehicle positions as instantaneous point-flashes locked to exact stop arrival times, the visual artifacts of simplified linear interpolation (such as vehicles awkwardly warping or cutting through buildings) are entirely mitigated. As a result, V4.1 achieves a uniform, consistent web simulation interface across all four municipalities, transforming highly heterogeneous local inputs into a crisp, synchronized regional asset. 3. Key Innovations & Critical Distinctions from Precedents Compared to existing solutions like gtfs-box or conventional Web-GIS platforms, this package maintains three decisive advantages tailored for data science and field applications: I. Infrastructure-Free, Single-Script Execution Unlike heavyweight academic or industrial solutions that rely on a multi-layered server-side infrastructure (e.g., PostgreSQL/PostGIS, OpenTripPlanner, GeoServer, and PHP), this framework operates completely within a standard desktop R environment. Users can execute data conversion and interactive mapping simply by running a single script, making it uniquely agile for time-constrained university workshops and resource-limited municipal planning offices. II. Direct Optimization for the R Data Science Ecosystem Built entirely via native R packages (shiny, leaflet, tidyverse, sf), the platform avoids black-box operations. Researchers can directly audit, modify, and extend the internal spatiotemporal manipulation logic within a familiar scripting environment, seamlessly bridging dynamic transit animations with subsequent regional spatial statistics. III. Persistent, Holistic Multi-Route Visual Management Rather than isolating specific operators or requiring a user click to render individual transit paths, this program persistently renders the entirety of the regional transit network in unique route colors from the moment of initialization. Vehicle point markers move along the map color-coded to their active transit lines, allowing planners to intuitively evaluate overlapping corridors, schedule synchronization, and macro-level network design from a high-level policy perspective. 5. Public Deployment & Web-Based Interactive Simulators (Updated to v4.1) To demonstrate the utility of the dataset and the optimized preprocessing pipeline, the interactive spatiotemporal simulators are publicly deployed and accessible directly via web browsers. Integrated 4-Operator Regional Simulator (Chita Peninsula Edition) This production version integrates four transit systems (Higashiura Town, Chita City, Obu City, and Agui Town) onto a single timeline. Primary Cloud Server: https://moteki.shinyapps.io/transit_chita/ High-Availability Mirror Server (No Uptime Restrictions): https://www.policyevaluation.net/transit_chita/ Technical Note: Thanks to the decoupled GeoPackage architecture introduced in Version 4.1, the runtime memory and processing overhead have been drastically reduced. This allows the 4-operator application to launch instantaneously and operate smoothly even on standard, resource-constrained rental web server environments without active uptime limitations. https://moteki.shinyapps.io/chita_transit4/ Resolution of Route Alignment Inaccuracies via V4.1 Paradigm In earlier trial versions (v3.9/v4.0), a geometric mismatch and track inaccuracy were identified along specific sections, such as Agui Town's Orange Line extending westward from the vicinity of Piago. Version 4.1 has systematically resolved this issue. By shifting the visual paradigm from continuous line-routing to a spatiotemporal pulse-emissive (point-based) representation, the simulation successfully circumvents these missing or inaccurate geometric tracks. The application now achieves a uniform, robustly consistent visualization across all four operators without distorted linear interpolations. 3-Municipality Trial Version (Legacy Archive) The original demonstration version covering three municipalities remains active as a historical baseline. Main Link: https://policyevaluation.net/transit/ Backup Link: https://moteki.shinyapps.io/transit/ Server Hosting & Local Execution Limits Due to the standard resource hosting thresholds on cloud platforms (such as shinyapps.io), the demonstration instances may occasionally encounter temporary connection interruptions during peak traffic. If a connection error screen is displayed, users are encouraged to download the optimized GeoPackage assets and source code from this repository to run the application seamlessly within a local R/Shiny environment. 6. Guide to Related Versions Version 2.0 (Static Flow Mapping Edition): For users who prefer a straightforward, static visualization of GTFS data (such as infrastructure flow mapping), the legacy Version 2.0 remains fully accessible via the link below: Moteki, Y. (2026). R Code for Regional Analysis: Interactive Flow Mapping of Public Transport Infrastructure using Leaflet and GTFS Data (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20116368 GTFS-Realtime Integration Framework (Related Repository): For users interested in working with actual real-time data feeds (GTFS-Realtime) and exploring integrated visualization frameworks—featuring empirical cases such as the Toei Bus, Chita City "Aiai Bus", and Hiroshima Electric Railway Bus—the following sister repository is highly recommended: Moteki, Y. (2026). R Code for Regional Analysis: Integrated GTFS-Static and Realtime Public Transit Data Visualization Framework (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20278677 7. Open Data Used (GTFS) The sample datasets utilized in this program are constructed based on the following publicly available open data: [Higashiura Town (Community Bus "U-ra-ra")] Data Creator: Higashiura Town Data Source: Repository of Standard General Transit Feed Specification (GTFS) Datasets (Higashiura Town) https://gtfs-data.jp/search?&agencyId=higashiuratown (Note: Download by clicking the "GTFS" item under the "URLs" column in the data table. Example filename: feed_higashiuratown_communitybus_20260227_20260327151527.zip) Procedures for Local File Placement: Decompress the obtained GTFS dataset (ZIP file) in your local environment. Move and place the resulting decompressed folder (e.g., feed_higashiuratown_communitybus_20260227_20260327151527) directly into the root of your R working directory, without altering its name or internal structure. Upon executing the program, the script will automatically parse and load the required text files—such as routes.txt, trips.txt, stops.txt, shapes.txt, and stop_times.txt—locally from the designated folder. [Chita City (Community Bus "Aiai Bus")] Data Creator: Chita City Data Source: Repository of Standard General Transit Feed Specification (GTFS) Datasets (Chita City) https://gtfs-data.jp/search?&agencyId=chitacity (Note: The Chita City version of the program incorporates automated logic that directly fetches, decompresses, and processes the latest GTFS ZIP feed over the Web. Therefore, manual pre-downloading or local folder placement is not required for this specific component.) [Chita Bus (Commercial Route: Chita Noriai Co., Ltd.)] Data Creator: Chita Noriai Co., Ltd. Data Source: Repository of Standard General Transit Feed Specification (GTFS) Datasets (Chita Bus) https://gtfs-data.jp/search?agencyId=chitabus Procedures for Local File Placement (Identical to the "U-ra-ra" procedure described above): Decompress the obtained Chita Bus GTFS dataset (ZIP file) in your local environment. Move and place the resulting decompressed folder (e.g., feed_chitabus_chitabus_20260201_20260210144826) directly into the root of your R working directory, without altering its name or internal structure. Upon executing the program, the script will automatically parse and load the required text files—such as routes.txt, trips.txt, stops.txt, shapes.txt, and stop_times.txt—locally from the designated folder. 8. Academic and Practical Value The spatial accuracy and routing logic of this script have been verified and cross-referenced against the General Public Transport Map (Zakkuri Map) found within "How to Start Fun Public Transport," published by the Higashiura Town Regional Public Transport Council (validated at the v1.0 development stage). It serves as a highly versatile, turn-key baseline platform for other local government bodies, transport researchers, and students to "instantly convert raw local GTFS feeds into maps and empirically audit operational patterns with their own eyes." Furthermore, the rendering colors utilized for the routes in this application are synchronized with the official General Public Transport Map (extracted directly from the hex color codes embedded within the raw GTFS data). 10. Technical Notes: Safely Stopping the Application and Restarting the R Session When modifying the code, following these two steps—"stopping the program" and "restarting the R session"—is the safest approach to ensure that changes are correctly reflected on the screen and to prevent malfunctions caused by residual memory. (1) Stopping the Running Application (Releasing the Console) Before rewriting the code, always click the red stop button located in the upper right corner of the RStudio console (or within the Viewer pane) to explicitly stop the application. Simply closing the browser window may leave the local web server process running in the background, risking port conflict errors upon the next launch. Pressing the stop button safely shuts down the process and releases the occupied console. (2) Restarting the R Session (Complete Memory Initialization) After stopping the application, select Session ➔ Restart R from the RStudio menu bar (Shortcut: Ctrl + Shift + F10 / Cmd + Shift + F10 on Mac) to completely initialize the R session. In scripts like this one, where large amounts of GTFS data are pre-loaded into memory, caches of old objects and functions tend to persist. Restarting completely clears the memory, ensuring that the latest modified UI parameters and logic are loaded in a 100% clean state.
