How can I pull a group-based vector to pass to a function within dplyr's summarize or mutate?How can I view the source code for a function?Conditional summarize of groups in dplyr based on dateWhen does dplyr's mutate function work with a database?dplyr NSE - how pass column names to mutate function call?Using switch statement within dplyr's mutatedplyr's mutate at each column separately with a custom function of several parametrsdplyr mutate with within group select functiondplyr mutate based on columns in a vectorPassing an external function (and arguments) to dplyr summarize or mutateChange value by group based in reference within group

How to prevent "they're falling in love" trope

How do I deal with an unproductive colleague in a small company?

Im going to France and my passport expires June 19th

What exploit Are these user agents trying to use?

Venezuelan girlfriend wants to travel the USA to be with me. What is the process?

Reverse dictionary where values are lists

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Why didn't Boeing produce its own regional jet?

Personal Teleportation: From Rags to Riches

How did the Super Star Destroyer Executor get destroyed exactly?

Is it possible to create a QR code using text?

What's the in-universe reasoning behind sorcerers needing material components?

Why no variance term in Bayesian logistic regression?

How does a predictive coding aid in lossless compression?

Forgetting the musical notes while performing in concert

Can a virus destroy the BIOS of a modern computer?

Can compressed videos be decoded back to their uncompresed original format?

Mathematica command that allows it to read my intentions

Do UK voters know if their MP will be the Speaker of the House?

Apex Framework / library for consuming REST services

Intersection Puzzle

What mechanic is there to disable a threat instead of killing it?

Unable to supress ligatures in headings which are set in Caps

Arrow those variables!



How can I pull a group-based vector to pass to a function within dplyr's summarize or mutate?


How can I view the source code for a function?Conditional summarize of groups in dplyr based on dateWhen does dplyr's mutate function work with a database?dplyr NSE - how pass column names to mutate function call?Using switch statement within dplyr's mutatedplyr's mutate at each column separately with a custom function of several parametrsdplyr mutate with within group select functiondplyr mutate based on columns in a vectorPassing an external function (and arguments) to dplyr summarize or mutateChange value by group based in reference within group













2















I am trying to create a summary table of accuracy, sensitivity, and specificity using the AUC function within the psych package. I would like to define the input vector (t, a 4 x 1 vector) for each level of the grouped variable.



What I have tried seems to ignore the grouping.



Example:



library(tidyverse)
library(psych)

Data <- data.frame(Class = c("A","B","C","D"),
TP = c(198,185,221,192),
FP = c(1,1,6,1),
FN = c(42,55,19,48),
TN = c(569,570,564,569))

Data %>%
group_by(Class) %>%
mutate(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


This gives me close to the correct output, except the values for Accuracy, Sensitivity, and Specificity are only being calculated with the first row, then repeated:



# A tibble: 4 x 8
# Groups: Class [4]
Class TP FP FN TN Accuracy Sensitivity Specificity
<fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 A 198 1 42 569 0.947 0.995 0.931
2 B 185 0 55 570 0.947 0.995 0.931
3 C 221 6 19 564 0.947 0.995 0.931
4 D 192 1 48 569 0.947 0.995 0.931


I have also tried with summarize:



Data %>% 
group_by(Class) %>%
summarize(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


But the output is the same as above.



The desired output is a unique calculation for each level of "Class"



# A tibble: 4 x 8
Class TP FP FN TN Accuracy Sensitivity Specificity
<fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 A 198 1 42 569 0.95 0.99 0.93
2 B 185 0 55 570 0.93 0.99 0.91
3 C 221 6 19 564 0.97 0.97 0.97
4 D 192 1 48 569 0.94 0.99 0.92


How do I get the function call within summarize or mutate to maintain the groups?










share|improve this question


























    2















    I am trying to create a summary table of accuracy, sensitivity, and specificity using the AUC function within the psych package. I would like to define the input vector (t, a 4 x 1 vector) for each level of the grouped variable.



    What I have tried seems to ignore the grouping.



    Example:



    library(tidyverse)
    library(psych)

    Data <- data.frame(Class = c("A","B","C","D"),
    TP = c(198,185,221,192),
    FP = c(1,1,6,1),
    FN = c(42,55,19,48),
    TN = c(569,570,564,569))

    Data %>%
    group_by(Class) %>%
    mutate(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
    Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
    Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


    This gives me close to the correct output, except the values for Accuracy, Sensitivity, and Specificity are only being calculated with the first row, then repeated:



    # A tibble: 4 x 8
    # Groups: Class [4]
    Class TP FP FN TN Accuracy Sensitivity Specificity
    <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
    1 A 198 1 42 569 0.947 0.995 0.931
    2 B 185 0 55 570 0.947 0.995 0.931
    3 C 221 6 19 564 0.947 0.995 0.931
    4 D 192 1 48 569 0.947 0.995 0.931


    I have also tried with summarize:



    Data %>% 
    group_by(Class) %>%
    summarize(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
    Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
    Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


    But the output is the same as above.



    The desired output is a unique calculation for each level of "Class"



    # A tibble: 4 x 8
    Class TP FP FN TN Accuracy Sensitivity Specificity
    <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
    1 A 198 1 42 569 0.95 0.99 0.93
    2 B 185 0 55 570 0.93 0.99 0.91
    3 C 221 6 19 564 0.97 0.97 0.97
    4 D 192 1 48 569 0.94 0.99 0.92


    How do I get the function call within summarize or mutate to maintain the groups?










    share|improve this question
























      2












      2








      2








      I am trying to create a summary table of accuracy, sensitivity, and specificity using the AUC function within the psych package. I would like to define the input vector (t, a 4 x 1 vector) for each level of the grouped variable.



      What I have tried seems to ignore the grouping.



      Example:



      library(tidyverse)
      library(psych)

      Data <- data.frame(Class = c("A","B","C","D"),
      TP = c(198,185,221,192),
      FP = c(1,1,6,1),
      FN = c(42,55,19,48),
      TN = c(569,570,564,569))

      Data %>%
      group_by(Class) %>%
      mutate(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
      Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
      Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


      This gives me close to the correct output, except the values for Accuracy, Sensitivity, and Specificity are only being calculated with the first row, then repeated:



      # A tibble: 4 x 8
      # Groups: Class [4]
      Class TP FP FN TN Accuracy Sensitivity Specificity
      <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
      1 A 198 1 42 569 0.947 0.995 0.931
      2 B 185 0 55 570 0.947 0.995 0.931
      3 C 221 6 19 564 0.947 0.995 0.931
      4 D 192 1 48 569 0.947 0.995 0.931


      I have also tried with summarize:



      Data %>% 
      group_by(Class) %>%
      summarize(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
      Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
      Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


      But the output is the same as above.



      The desired output is a unique calculation for each level of "Class"



      # A tibble: 4 x 8
      Class TP FP FN TN Accuracy Sensitivity Specificity
      <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
      1 A 198 1 42 569 0.95 0.99 0.93
      2 B 185 0 55 570 0.93 0.99 0.91
      3 C 221 6 19 564 0.97 0.97 0.97
      4 D 192 1 48 569 0.94 0.99 0.92


      How do I get the function call within summarize or mutate to maintain the groups?










      share|improve this question














      I am trying to create a summary table of accuracy, sensitivity, and specificity using the AUC function within the psych package. I would like to define the input vector (t, a 4 x 1 vector) for each level of the grouped variable.



      What I have tried seems to ignore the grouping.



      Example:



      library(tidyverse)
      library(psych)

      Data <- data.frame(Class = c("A","B","C","D"),
      TP = c(198,185,221,192),
      FP = c(1,1,6,1),
      FN = c(42,55,19,48),
      TN = c(569,570,564,569))

      Data %>%
      group_by(Class) %>%
      mutate(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
      Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
      Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


      This gives me close to the correct output, except the values for Accuracy, Sensitivity, and Specificity are only being calculated with the first row, then repeated:



      # A tibble: 4 x 8
      # Groups: Class [4]
      Class TP FP FN TN Accuracy Sensitivity Specificity
      <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
      1 A 198 1 42 569 0.947 0.995 0.931
      2 B 185 0 55 570 0.947 0.995 0.931
      3 C 221 6 19 564 0.947 0.995 0.931
      4 D 192 1 48 569 0.947 0.995 0.931


      I have also tried with summarize:



      Data %>% 
      group_by(Class) %>%
      summarize(Accuracy = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Accuracy,
      Sensitivity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Sensitivity,
      Specificity = AUC(t = unlist(.[1,2:5], use.names=FALSE))$Specificity)


      But the output is the same as above.



      The desired output is a unique calculation for each level of "Class"



      # A tibble: 4 x 8
      Class TP FP FN TN Accuracy Sensitivity Specificity
      <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
      1 A 198 1 42 569 0.95 0.99 0.93
      2 B 185 0 55 570 0.93 0.99 0.91
      3 C 221 6 19 564 0.97 0.97 0.97
      4 D 192 1 48 569 0.94 0.99 0.92


      How do I get the function call within summarize or mutate to maintain the groups?







      r dplyr tidyverse mutate summarize






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 22:40









      JLCJLC

      1869




      1869






















          2 Answers
          2






          active

          oldest

          votes


















          0














          This works



          Data %>% 
          group_by(Class) %>%
          mutate(Accuracy = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Accuracy,
          Sensitivity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Sensitivity,
          Specificity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Specificity)


          but maybe this is more clear



          Data %>% 
          group_by(Class) %>%
          mutate(Accuracy = AUC(t = c(TP, FP, FN, TN))$Accuracy,
          Sensitivity = AUC(t = c(TP, FP, FN, TN))$Sensitivity,
          Specificity = AUC(t = c(TP, FP, FN, TN))$Specificity)





          share|improve this answer
































            0














            To avoid calling AUC several times for each class, I'd write a wrapper, like this:



            # Load libraries
            library(tidyverse)
            library(psych)

            # Create data frame
            Data <- data.frame(Class = c("A","B","C","D"),
            TP = c(198,185,221,192),
            FP = c(1,1,6,1),
            FN = c(42,55,19,48),
            TN = c(569,570,564,569))

            # Wrapper function
            AUC_wrapper <- function(Class, TP, FP, FN, TN)
            res <- AUC(t = c(TP, FP, FN, TN))
            data.frame(Class = Class,
            TP = TP,
            FP = FP,
            FN = FN,
            TN = TN,
            Accuracy = res$Accuracy,
            Sensitivity = res$Sensitivity,
            Specificity = res$Specificity)


            # Run using purrr
            pmap_dfr(Data, AUC_wrapper)

            # Class TP FP FN TN Accuracy Sensitivity Specificity
            # 1 A 198 1 42 569 0.9469136 0.9949749 0.9312602
            # 2 B 185 1 55 570 0.9309494 0.9946237 0.9120000
            # 3 C 221 6 19 564 0.9691358 0.9735683 0.9674099
            # 4 D 192 1 48 569 0.9395062 0.9948187 0.9222042





            share|improve this answer























            • This is dropping the Class names and outputting factor levels for me

              – JLC
              Mar 8 at 2:49











            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%2f55053971%2fhow-can-i-pull-a-group-based-vector-to-pass-to-a-function-within-dplyrs-summari%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            This works



            Data %>% 
            group_by(Class) %>%
            mutate(Accuracy = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Accuracy,
            Sensitivity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Sensitivity,
            Specificity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Specificity)


            but maybe this is more clear



            Data %>% 
            group_by(Class) %>%
            mutate(Accuracy = AUC(t = c(TP, FP, FN, TN))$Accuracy,
            Sensitivity = AUC(t = c(TP, FP, FN, TN))$Sensitivity,
            Specificity = AUC(t = c(TP, FP, FN, TN))$Specificity)





            share|improve this answer





























              0














              This works



              Data %>% 
              group_by(Class) %>%
              mutate(Accuracy = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Accuracy,
              Sensitivity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Sensitivity,
              Specificity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Specificity)


              but maybe this is more clear



              Data %>% 
              group_by(Class) %>%
              mutate(Accuracy = AUC(t = c(TP, FP, FN, TN))$Accuracy,
              Sensitivity = AUC(t = c(TP, FP, FN, TN))$Sensitivity,
              Specificity = AUC(t = c(TP, FP, FN, TN))$Specificity)





              share|improve this answer



























                0












                0








                0







                This works



                Data %>% 
                group_by(Class) %>%
                mutate(Accuracy = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Accuracy,
                Sensitivity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Sensitivity,
                Specificity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Specificity)


                but maybe this is more clear



                Data %>% 
                group_by(Class) %>%
                mutate(Accuracy = AUC(t = c(TP, FP, FN, TN))$Accuracy,
                Sensitivity = AUC(t = c(TP, FP, FN, TN))$Sensitivity,
                Specificity = AUC(t = c(TP, FP, FN, TN))$Specificity)





                share|improve this answer















                This works



                Data %>% 
                group_by(Class) %>%
                mutate(Accuracy = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Accuracy,
                Sensitivity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Sensitivity,
                Specificity = AUC(t = unlist(.[Class,2:5], use.names=FALSE))$Specificity)


                but maybe this is more clear



                Data %>% 
                group_by(Class) %>%
                mutate(Accuracy = AUC(t = c(TP, FP, FN, TN))$Accuracy,
                Sensitivity = AUC(t = c(TP, FP, FN, TN))$Sensitivity,
                Specificity = AUC(t = c(TP, FP, FN, TN))$Specificity)






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 8 at 1:23

























                answered Mar 7 at 23:14









                ericOssericOss

                913




                913























                    0














                    To avoid calling AUC several times for each class, I'd write a wrapper, like this:



                    # Load libraries
                    library(tidyverse)
                    library(psych)

                    # Create data frame
                    Data <- data.frame(Class = c("A","B","C","D"),
                    TP = c(198,185,221,192),
                    FP = c(1,1,6,1),
                    FN = c(42,55,19,48),
                    TN = c(569,570,564,569))

                    # Wrapper function
                    AUC_wrapper <- function(Class, TP, FP, FN, TN)
                    res <- AUC(t = c(TP, FP, FN, TN))
                    data.frame(Class = Class,
                    TP = TP,
                    FP = FP,
                    FN = FN,
                    TN = TN,
                    Accuracy = res$Accuracy,
                    Sensitivity = res$Sensitivity,
                    Specificity = res$Specificity)


                    # Run using purrr
                    pmap_dfr(Data, AUC_wrapper)

                    # Class TP FP FN TN Accuracy Sensitivity Specificity
                    # 1 A 198 1 42 569 0.9469136 0.9949749 0.9312602
                    # 2 B 185 1 55 570 0.9309494 0.9946237 0.9120000
                    # 3 C 221 6 19 564 0.9691358 0.9735683 0.9674099
                    # 4 D 192 1 48 569 0.9395062 0.9948187 0.9222042





                    share|improve this answer























                    • This is dropping the Class names and outputting factor levels for me

                      – JLC
                      Mar 8 at 2:49















                    0














                    To avoid calling AUC several times for each class, I'd write a wrapper, like this:



                    # Load libraries
                    library(tidyverse)
                    library(psych)

                    # Create data frame
                    Data <- data.frame(Class = c("A","B","C","D"),
                    TP = c(198,185,221,192),
                    FP = c(1,1,6,1),
                    FN = c(42,55,19,48),
                    TN = c(569,570,564,569))

                    # Wrapper function
                    AUC_wrapper <- function(Class, TP, FP, FN, TN)
                    res <- AUC(t = c(TP, FP, FN, TN))
                    data.frame(Class = Class,
                    TP = TP,
                    FP = FP,
                    FN = FN,
                    TN = TN,
                    Accuracy = res$Accuracy,
                    Sensitivity = res$Sensitivity,
                    Specificity = res$Specificity)


                    # Run using purrr
                    pmap_dfr(Data, AUC_wrapper)

                    # Class TP FP FN TN Accuracy Sensitivity Specificity
                    # 1 A 198 1 42 569 0.9469136 0.9949749 0.9312602
                    # 2 B 185 1 55 570 0.9309494 0.9946237 0.9120000
                    # 3 C 221 6 19 564 0.9691358 0.9735683 0.9674099
                    # 4 D 192 1 48 569 0.9395062 0.9948187 0.9222042





                    share|improve this answer























                    • This is dropping the Class names and outputting factor levels for me

                      – JLC
                      Mar 8 at 2:49













                    0












                    0








                    0







                    To avoid calling AUC several times for each class, I'd write a wrapper, like this:



                    # Load libraries
                    library(tidyverse)
                    library(psych)

                    # Create data frame
                    Data <- data.frame(Class = c("A","B","C","D"),
                    TP = c(198,185,221,192),
                    FP = c(1,1,6,1),
                    FN = c(42,55,19,48),
                    TN = c(569,570,564,569))

                    # Wrapper function
                    AUC_wrapper <- function(Class, TP, FP, FN, TN)
                    res <- AUC(t = c(TP, FP, FN, TN))
                    data.frame(Class = Class,
                    TP = TP,
                    FP = FP,
                    FN = FN,
                    TN = TN,
                    Accuracy = res$Accuracy,
                    Sensitivity = res$Sensitivity,
                    Specificity = res$Specificity)


                    # Run using purrr
                    pmap_dfr(Data, AUC_wrapper)

                    # Class TP FP FN TN Accuracy Sensitivity Specificity
                    # 1 A 198 1 42 569 0.9469136 0.9949749 0.9312602
                    # 2 B 185 1 55 570 0.9309494 0.9946237 0.9120000
                    # 3 C 221 6 19 564 0.9691358 0.9735683 0.9674099
                    # 4 D 192 1 48 569 0.9395062 0.9948187 0.9222042





                    share|improve this answer













                    To avoid calling AUC several times for each class, I'd write a wrapper, like this:



                    # Load libraries
                    library(tidyverse)
                    library(psych)

                    # Create data frame
                    Data <- data.frame(Class = c("A","B","C","D"),
                    TP = c(198,185,221,192),
                    FP = c(1,1,6,1),
                    FN = c(42,55,19,48),
                    TN = c(569,570,564,569))

                    # Wrapper function
                    AUC_wrapper <- function(Class, TP, FP, FN, TN)
                    res <- AUC(t = c(TP, FP, FN, TN))
                    data.frame(Class = Class,
                    TP = TP,
                    FP = FP,
                    FN = FN,
                    TN = TN,
                    Accuracy = res$Accuracy,
                    Sensitivity = res$Sensitivity,
                    Specificity = res$Specificity)


                    # Run using purrr
                    pmap_dfr(Data, AUC_wrapper)

                    # Class TP FP FN TN Accuracy Sensitivity Specificity
                    # 1 A 198 1 42 569 0.9469136 0.9949749 0.9312602
                    # 2 B 185 1 55 570 0.9309494 0.9946237 0.9120000
                    # 3 C 221 6 19 564 0.9691358 0.9735683 0.9674099
                    # 4 D 192 1 48 569 0.9395062 0.9948187 0.9222042






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 7 at 23:22









                    LyngbakrLyngbakr

                    5,45811428




                    5,45811428












                    • This is dropping the Class names and outputting factor levels for me

                      – JLC
                      Mar 8 at 2:49

















                    • This is dropping the Class names and outputting factor levels for me

                      – JLC
                      Mar 8 at 2:49
















                    This is dropping the Class names and outputting factor levels for me

                    – JLC
                    Mar 8 at 2:49





                    This is dropping the Class names and outputting factor levels for me

                    – JLC
                    Mar 8 at 2:49

















                    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%2f55053971%2fhow-can-i-pull-a-group-based-vector-to-pass-to-a-function-within-dplyrs-summari%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 у кіно

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

                    Ель Греко