R-help - Shiny and Datatable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

R-help - Shiny and Datatable

Joe Larson
Hello,
 I am getting wrapped around the axial on a shiny project, being a new R
learner I am asking for some help. I am trying to combine CDC data, Shiny,
and leaflet together to produce a map that has the top 500 USA cities with
adverse medical outcomes.  The goal is to allow the user to select either
the range of outcome, state or adverse outcome.  Through Shiny examples, I
am able to get the range function to work, but not the "state" or "health
outcomes" to function correctly. My issue is in using input type selectable
 "selectInput("state", "State Abbr", data_c$state, selected = NULL,
multiple = FALSE, selectize = TRUE, width = NULL, size = NULL), "  The
challenge I am facing is selecting the correct "Render reactive output"
 and how to mutate the datatable so the users inputs are correctly
displayed.  If you want the full code, to let me know.
I have been reading shiny.rstudios.com as well the shiny-cheatsheet.pdf
with the solution not coming to mind.
Thanks for any suggestion you can offer.

The datatable has this format (first 2 cities and allThe isisue is I can
not find out which type of 13 outcomens):
X year state cityname crudeprevalence populationcount measureid lat long
healthoutcome metropop
1 2014 AL Birmingham 32.6 212237 ARTHRITIS 33.52756638 -86.79881747
0.0153 Birmingham(city),
212237(popluation), 0.0153(Arthritis %)
2 2013 AL Birmingham 45.9 212237 BPHIGH 33.52756638 -86.79881747
0.0216 Birmingham(city),
212237(popluation), 0.0216(High blood pressure %)
3 2014 AL Birmingham 6.1 212237 CANCER 33.52756638 -86.79881747 0.0028
Birmingham(city),
212237(popluation), 0.0028(Cancer (excluding skin cancer)  %)
4 2014 AL Birmingham 11.4 212237 CASTHMA 33.52756638 -86.79881747
0.0053 Birmingham(city),
212237(popluation), 0.0053(Asthma %)
5 2014 AL Birmingham 7.6 212237 CHD 33.52756638 -86.79881747 0.0035
Birmingham(city),
212237(popluation), 0.0035(Coronary heart disease %)
6 2014 AL Birmingham 9.4 212237 COPD 33.52756638 -86.79881747 0.0044
Birmingham(city),
212237(popluation), 0.0044(Chronic obstructive pulmonary disease %)
7 2014 AL Birmingham 16.1 212237 DIABETES 33.52756638 -86.79881747
0.0075 Birmingham(city),
212237(popluation), 0.0075(Diabetes %)
8 2013 AL Birmingham 35.4 212237 HIGHCHOL 33.52756638 -86.79881747
0.0166 Birmingham(city),
212237(popluation), 0.0166(High cholesterol %)
9 2014 AL Birmingham 3.3 212237 KIDNEY 33.52756638 -86.79881747 0.0015
Birmingham(city),
212237(popluation), 0.0015(Kidney disease %)
10 2014 AL Birmingham 17 212237 MHLTH 33.52756638 -86.79881747 0.008
Birmingham(city),
212237(popluation), 0.008(Mental health %)
11 2014 AL Birmingham 18.3 212237 PHLTH 33.52756638 -86.79881747
0.0086 Birmingham(city),
212237(popluation), 0.0086(Physical health %)
12 2014 AL Birmingham 5 212237 STROKE 33.52756638 -86.79881747 0.0023
Birmingham(city),
212237(popluation), 0.0023(Stroke %)
13 2014 AL Birmingham 25.9 212237 TEETHLOST 33.52756638 -86.79881747
0.0122 Birmingham(city),
212237(popluation), 0.0122(All teeth lost %)
14 2014 AL Hoover 25.3 81619 ARTHRITIS 33.37676027 -86.80519376 0.0309
Hoover(city),
81619(popluation), 0.0309(Arthritis %)
Thanks for you help and insight in advance
Joe

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: R-help - Shiny and Datatable

chris english-2
Joe,

If you look again at the CDC, USA 500 ,(
https://chronicdata.cdc.gov/500-Cities/500-Cities-Local-Data-for-Better-Health/6vp6-wxuq
),
the top 26 rows are USA crude prevalence  then age adjusted prevalence by
disease (for 2014), or the 13 (either crude prevalence, or age adjusted)
that you are looking for.

Judging by what you were describing above, it doesn't sound like you're
doing a 'things got better or things got worse,
year on year', so perhaps filtering the data to a given year (2014) and
given  health outcome (age adjusted) prior to
downloading might simplify things.
HTH
Chris

On Sun, Apr 23, 2017 at 6:19 PM, Joe Larson <[hidden email]>
wrote:

> Hello,
>  I am getting wrapped around the axial on a shiny project, being a new R
> learner I am asking for some help. I am trying to combine CDC data, Shiny,
> and leaflet together to produce a map that has the top 500 USA cities with
> adverse medical outcomes.  The goal is to allow the user to select either
> the range of outcome, state or adverse outcome.  Through Shiny examples, I
> am able to get the range function to work, but not the "state" or "health
> outcomes" to function correctly. My issue is in using input type selectable
>  "selectInput("state", "State Abbr", data_c$state, selected = NULL,
> multiple = FALSE, selectize = TRUE, width = NULL, size = NULL), "  The
> challenge I am facing is selecting the correct "Render reactive output"
>  and how to mutate the datatable so the users inputs are correctly
> displayed.  If you want the full code, to let me know.
> I have been reading shiny.rstudios.com as well the shiny-cheatsheet.pdf
> with the solution not coming to mind.
> Thanks for any suggestion you can offer.
>
> The datatable has this format (first 2 cities and allThe isisue is I can
> not find out which type of 13 outcomens):
> X year state cityname crudeprevalence populationcount measureid lat long
> healthoutcome metropop
> 1 2014 AL Birmingham 32.6 212237 ARTHRITIS 33.52756638 -86.79881747
> 0.0153 Birmingham(city),
> 212237(popluation), 0.0153(Arthritis %)
> 2 2013 AL Birmingham 45.9 212237 BPHIGH 33.52756638 -86.79881747
> 0.0216 Birmingham(city),
> 212237(popluation), 0.0216(High blood pressure %)
> 3 2014 AL Birmingham 6.1 212237 CANCER 33.52756638 -86.79881747 0.0028
> Birmingham(city),
> 212237(popluation), 0.0028(Cancer (excluding skin cancer)  %)
> 4 2014 AL Birmingham 11.4 212237 CASTHMA 33.52756638 -86.79881747
> 0.0053 Birmingham(city),
> 212237(popluation), 0.0053(Asthma %)
> 5 2014 AL Birmingham 7.6 212237 CHD 33.52756638 -86.79881747 0.0035
> Birmingham(city),
> 212237(popluation), 0.0035(Coronary heart disease %)
> 6 2014 AL Birmingham 9.4 212237 COPD 33.52756638 -86.79881747 0.0044
> Birmingham(city),
> 212237(popluation), 0.0044(Chronic obstructive pulmonary disease %)
> 7 2014 AL Birmingham 16.1 212237 DIABETES 33.52756638 -86.79881747
> 0.0075 Birmingham(city),
> 212237(popluation), 0.0075(Diabetes %)
> 8 2013 AL Birmingham 35.4 212237 HIGHCHOL 33.52756638 -86.79881747
> 0.0166 Birmingham(city),
> 212237(popluation), 0.0166(High cholesterol %)
> 9 2014 AL Birmingham 3.3 212237 KIDNEY 33.52756638 -86.79881747 0.0015
> Birmingham(city),
> 212237(popluation), 0.0015(Kidney disease %)
> 10 2014 AL Birmingham 17 212237 MHLTH 33.52756638 -86.79881747 0.008
> Birmingham(city),
> 212237(popluation), 0.008(Mental health %)
> 11 2014 AL Birmingham 18.3 212237 PHLTH 33.52756638 -86.79881747
> 0.0086 Birmingham(city),
> 212237(popluation), 0.0086(Physical health %)
> 12 2014 AL Birmingham 5 212237 STROKE 33.52756638 -86.79881747 0.0023
> Birmingham(city),
> 212237(popluation), 0.0023(Stroke %)
> 13 2014 AL Birmingham 25.9 212237 TEETHLOST 33.52756638 -86.79881747
> 0.0122 Birmingham(city),
> 212237(popluation), 0.0122(All teeth lost %)
> 14 2014 AL Hoover 25.3 81619 ARTHRITIS 33.37676027 -86.80519376 0.0309
> Hoover(city),
> 81619(popluation), 0.0309(Arthritis %)
> Thanks for you help and insight in advance
> Joe
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: R-help - Shiny and Datatable

Kent Johnson
In reply to this post by Joe Larson
On Mon, Apr 24, 2017 at 6:00 AM, <[hidden email]> wrote:
>
> Message: 4
> Date: Sun, 23 Apr 2017 18:19:59 -0400
> From: Joe Larson <[hidden email]>
>
> Hello,
>  I am getting wrapped around the axial on a shiny project, being a new R
> learner I am asking for some help.... If you want the full code, to let me
> know.


Yes, if you can post your code and data somewhere that would make it easier
to help.

Kent

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Loading...