dynamic interaction plot invoked via combinations in array

Multi tool use
Multi tool use












0














I have this function:



dynamic_plot_1 <- function(x1, x2) {

Temp <- Data %>%
group_by(Var1 = !!ensym(x1), Var2 = !!ensym(x2)) %>%
summarise(
number_of_samples = n()
, median = median(bla)
)

Temp %>%
ggplot() +
aes(x = Var2, y = median, color = Var1) +
geom_line(aes(group = Var1), size = 1) +
geom_point() +
geom_text(aes(label = paste0('£', median, ', samples:', number_of_samples)), hjust = 0, vjust = 0, color = 'black') +
labs(x = x2, color = x1, y = 'bla')
}


which works fine when I invoke it like so:



dynamic_plot_1('x1', 'x2')


but not when I do this:



columns <- c(
'x1'
, 'x2'
)
combination_matrix <- combn(columns, 2)

for (col in 1:ncol(combination_matrix)) {
x1 <- quote(combination_matrix[1, col])
x2 <- quote(combination_matrix[2, col])
dynamic_plot_1(x1, x2)
}


Any idea? Thanks!










share|improve this question





























    0














    I have this function:



    dynamic_plot_1 <- function(x1, x2) {

    Temp <- Data %>%
    group_by(Var1 = !!ensym(x1), Var2 = !!ensym(x2)) %>%
    summarise(
    number_of_samples = n()
    , median = median(bla)
    )

    Temp %>%
    ggplot() +
    aes(x = Var2, y = median, color = Var1) +
    geom_line(aes(group = Var1), size = 1) +
    geom_point() +
    geom_text(aes(label = paste0('£', median, ', samples:', number_of_samples)), hjust = 0, vjust = 0, color = 'black') +
    labs(x = x2, color = x1, y = 'bla')
    }


    which works fine when I invoke it like so:



    dynamic_plot_1('x1', 'x2')


    but not when I do this:



    columns <- c(
    'x1'
    , 'x2'
    )
    combination_matrix <- combn(columns, 2)

    for (col in 1:ncol(combination_matrix)) {
    x1 <- quote(combination_matrix[1, col])
    x2 <- quote(combination_matrix[2, col])
    dynamic_plot_1(x1, x2)
    }


    Any idea? Thanks!










    share|improve this question



























      0












      0








      0







      I have this function:



      dynamic_plot_1 <- function(x1, x2) {

      Temp <- Data %>%
      group_by(Var1 = !!ensym(x1), Var2 = !!ensym(x2)) %>%
      summarise(
      number_of_samples = n()
      , median = median(bla)
      )

      Temp %>%
      ggplot() +
      aes(x = Var2, y = median, color = Var1) +
      geom_line(aes(group = Var1), size = 1) +
      geom_point() +
      geom_text(aes(label = paste0('£', median, ', samples:', number_of_samples)), hjust = 0, vjust = 0, color = 'black') +
      labs(x = x2, color = x1, y = 'bla')
      }


      which works fine when I invoke it like so:



      dynamic_plot_1('x1', 'x2')


      but not when I do this:



      columns <- c(
      'x1'
      , 'x2'
      )
      combination_matrix <- combn(columns, 2)

      for (col in 1:ncol(combination_matrix)) {
      x1 <- quote(combination_matrix[1, col])
      x2 <- quote(combination_matrix[2, col])
      dynamic_plot_1(x1, x2)
      }


      Any idea? Thanks!










      share|improve this question















      I have this function:



      dynamic_plot_1 <- function(x1, x2) {

      Temp <- Data %>%
      group_by(Var1 = !!ensym(x1), Var2 = !!ensym(x2)) %>%
      summarise(
      number_of_samples = n()
      , median = median(bla)
      )

      Temp %>%
      ggplot() +
      aes(x = Var2, y = median, color = Var1) +
      geom_line(aes(group = Var1), size = 1) +
      geom_point() +
      geom_text(aes(label = paste0('£', median, ', samples:', number_of_samples)), hjust = 0, vjust = 0, color = 'black') +
      labs(x = x2, color = x1, y = 'bla')
      }


      which works fine when I invoke it like so:



      dynamic_plot_1('x1', 'x2')


      but not when I do this:



      columns <- c(
      'x1'
      , 'x2'
      )
      combination_matrix <- combn(columns, 2)

      for (col in 1:ncol(combination_matrix)) {
      x1 <- quote(combination_matrix[1, col])
      x2 <- quote(combination_matrix[2, col])
      dynamic_plot_1(x1, x2)
      }


      Any idea? Thanks!







      r






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 16:55

























      asked Nov 12 at 16:41









      cs0815

      5,2461976193




      5,2461976193





























          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%2f53266521%2fdynamic-interaction-plot-invoked-via-combinations-in-array%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f53266521%2fdynamic-interaction-plot-invoked-via-combinations-in-array%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







          PkrXCmGAQmWuMH VGJpvjNOjHb4wTMG,Xl4,fY,SpMU9Scr M mc3K,tGd
          m7nCuJpaq4HlkZ7c1FQlMlMxGGUSh QEFxE8 lsXjIEm6Brg53awQjzYmbXt0,1,2K,IcAMb1H55LMTfcM0y

          Popular posts from this blog

          Bressuire

          Vorschmack

          Xamarin.iOS Cant Deploy on Iphone