How can I turn my main dataframe into a reactive object on start?

瘦欲@ 提交于 2019-12-08 13:18:43

问题


I developed a nice leaflet-based shiny app where users can visualize over 50 socio-urban-demographic variables on a map displaying over 3000 polygon features. Users can also pick and transform any variable, perform regressions, build custom indexes and even run a spatial clustering algorithm.

So, as you might have guessed already, the basic data structure consists of a main CSV dataframe featuring all the sociodemographic variables, and a shapeFile for the spatial polygons (both of which are merged). Upon users request, lots of reactive objects are created from the main CSV dataframe to feed the leaflet maps.

Problem is as follows: I now want users to be able to build their own variables (multiplying, dividing, adding up existing variables, etc). The newly created variables must stay readily available for all the other tools in the session. I thought the easiest way to do this was to append (more like, cbind) the new variables in the main CSV dataframe, but of course, shiny can't do this because the main dataframe it's not a reactive object.

It's like I need to turn the main CSV dataframe into a reactive object on start, but I can't find a way to do this, and even if I found it, I'm not sure if there are any drawbacks to this.

Help is appreciated!

来源:https://stackoverflow.com/questions/55945598/how-can-i-turn-my-main-dataframe-into-a-reactive-object-on-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!