{"id":22303661,"url":"https://github.com/thisisnic/shiny_reference_semantics_example","last_synced_at":"2025-03-26T00:34:03.577Z","repository":{"id":95725736,"uuid":"153602005","full_name":"thisisnic/Shiny_reference_semantics_example","owner":"thisisnic","description":"Example code to show how reactiveValues use reference semantics","archived":false,"fork":false,"pushed_at":"2018-10-18T10:33:42.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T21:20:36.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thisisnic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-18T09:53:57.000Z","updated_at":"2018-10-18T10:33:43.000Z","dependencies_parsed_at":"2023-05-21T19:00:29.505Z","dependency_job_id":null,"html_url":"https://github.com/thisisnic/Shiny_reference_semantics_example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisisnic%2FShiny_reference_semantics_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisisnic%2FShiny_reference_semantics_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisisnic%2FShiny_reference_semantics_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisisnic%2FShiny_reference_semantics_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisisnic","download_url":"https://codeload.github.com/thisisnic/Shiny_reference_semantics_example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245566146,"owners_count":20636391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T18:44:29.182Z","updated_at":"2025-03-26T00:34:03.551Z","avatar_url":"https://github.com/thisisnic.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shiny `reactiveValues` Reference Semantics\n\nIn Shiny, `reactiveValues()` can be used to create a list-like \nreactive object.  However, this object has special properties.  \n\nNormally in R, scoping rules mean that when you pass an object into a function\nas a parameter, __copy-on-modify__ semantics are used.  In other words, a copy of \nthat object is passed into the function, and so this copy is the one which the \nfunction can alter, and the original object is not modified.\n\nHowever, in the case of objects created using `reactiveValues()`, this is not\nthe case.  Objects created using `reactiveValues()` are R6 objects, and these kinds of objects use \n__reference semantics__.  This means that when we pass them into a function as a parameter, \nit is a reference to the original object that is is passed in, and so modifications made within the scope of the function are reflected outside of the function as well as within it.\n\nThe app in this repo shows a brief example of this.\n\nSee the reactiveValues section [in this blog post by yindeng for more information](https://shinydata.wordpress.com/2015/02/02/a-few-things-i-learned-about-shiny-and-reactive-programming/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisisnic%2Fshiny_reference_semantics_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisisnic%2Fshiny_reference_semantics_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisisnic%2Fshiny_reference_semantics_example/lists"}