Switch between data sets in R map2019 Community Moderator ElectionHow to join (merge) data frames (inner, outer, left, right)?How to Correctly Use Lists in R?How to improve a spatial raster map using ggplot when compared to spplot?Relocating Alaska and Hawaii on thematic map of the USA with ggplot2Add NA value to ggplot legend for continuous data mapManually colouring plots with `scale_fill_manual` in ggplot2 not workingShow Different Legend When Changing Layer - leafletarrange 3 separate maps into a grid with 1 legend and 1 titleGraphing lat/long data points on US map 50 states including Alaska & HawaiiGiving text to the legend of a ggplot2 map, for geom_point with 2 different variables

Grey hair or white hair

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

Rejected in 4th interview round citing insufficient years of experience

Is having access to past exams cheating and, if yes, could it be proven just by a good grade?

Why does Captain Marvel assume the planet where she lands would recognize her credentials?

Should I take out a loan for a friend to invest on my behalf?

What are some noteworthy "mic-drop" moments in math?

Logic. Truth of a negation

Replacing Windows 7 security updates with anti-virus?

Why would one plane in this picture not have gear down yet?

How are such low op-amp input currents possible?

Are the terms "stab" and "staccato" synonyms?

Aliens englobed the Solar System: will we notice?

Do items de-spawn in Diablo?

Things to avoid when using voltage regulators?

Append a note to one of three files based on user choice

What is the likely impact of grounding an entire aircraft series?

Time travel short story where dinosaur doesn't taste like chicken

They call me Inspector Morse

Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?

Single word request: Harming the benefactor

Why does the negative sign arise in this thermodynamic relation?

What is the chance of making a successful appeal to dismissal decision from a PhD program after failing the qualifying exam in the 2nd attempt?

What does a stand alone "T" index value do?



Switch between data sets in R map



2019 Community Moderator ElectionHow to join (merge) data frames (inner, outer, left, right)?How to Correctly Use Lists in R?How to improve a spatial raster map using ggplot when compared to spplot?Relocating Alaska and Hawaii on thematic map of the USA with ggplot2Add NA value to ggplot legend for continuous data mapManually colouring plots with `scale_fill_manual` in ggplot2 not workingShow Different Legend When Changing Layer - leafletarrange 3 separate maps into a grid with 1 legend and 1 titleGraphing lat/long data points on US map 50 states including Alaska & HawaiiGiving text to the legend of a ggplot2 map, for geom_point with 2 different variables










0















I have a map created with plot_usmap(data=d[c('state', 'a.pct')], values='a.pct') That shows percentages of thing A in different US States. This works great (although I'm still working on moving the legend off of Alaska), but now I want to add a button at the top that will let the user select if they want to see the data for thing b, i.e. plot_usmap(data=d[c('state', 'b.pct')], values='b.pct'). How would I go about doing this?



EDIT: I have updated my map to be created with leaflet and the legend is no longer an issue. I still can't figure out how to switch between datasets though.










share|improve this question
























  • I think you need shiny in order to do that. Maybe with leaflet you can avoid it

    – JonnyCrunch
    Mar 6 at 16:53















0















I have a map created with plot_usmap(data=d[c('state', 'a.pct')], values='a.pct') That shows percentages of thing A in different US States. This works great (although I'm still working on moving the legend off of Alaska), but now I want to add a button at the top that will let the user select if they want to see the data for thing b, i.e. plot_usmap(data=d[c('state', 'b.pct')], values='b.pct'). How would I go about doing this?



EDIT: I have updated my map to be created with leaflet and the legend is no longer an issue. I still can't figure out how to switch between datasets though.










share|improve this question
























  • I think you need shiny in order to do that. Maybe with leaflet you can avoid it

    – JonnyCrunch
    Mar 6 at 16:53













0












0








0








I have a map created with plot_usmap(data=d[c('state', 'a.pct')], values='a.pct') That shows percentages of thing A in different US States. This works great (although I'm still working on moving the legend off of Alaska), but now I want to add a button at the top that will let the user select if they want to see the data for thing b, i.e. plot_usmap(data=d[c('state', 'b.pct')], values='b.pct'). How would I go about doing this?



EDIT: I have updated my map to be created with leaflet and the legend is no longer an issue. I still can't figure out how to switch between datasets though.










share|improve this question
















I have a map created with plot_usmap(data=d[c('state', 'a.pct')], values='a.pct') That shows percentages of thing A in different US States. This works great (although I'm still working on moving the legend off of Alaska), but now I want to add a button at the top that will let the user select if they want to see the data for thing b, i.e. plot_usmap(data=d[c('state', 'b.pct')], values='b.pct'). How would I go about doing this?



EDIT: I have updated my map to be created with leaflet and the legend is no longer an issue. I still can't figure out how to switch between datasets though.







r ggplot2 usmap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 6 at 19:39







John Smith

















asked Mar 6 at 16:24









John SmithJohn Smith

114




114












  • I think you need shiny in order to do that. Maybe with leaflet you can avoid it

    – JonnyCrunch
    Mar 6 at 16:53

















  • I think you need shiny in order to do that. Maybe with leaflet you can avoid it

    – JonnyCrunch
    Mar 6 at 16:53
















I think you need shiny in order to do that. Maybe with leaflet you can avoid it

– JonnyCrunch
Mar 6 at 16:53





I think you need shiny in order to do that. Maybe with leaflet you can avoid it

– JonnyCrunch
Mar 6 at 16:53












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55027803%2fswitch-between-data-sets-in-r-map%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55027803%2fswitch-between-data-sets-in-r-map%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко