asterisk is appearing when using collapse rows












4















In the rmarkdown file below I am trying to use collapse rows. IN this case there is only 1 row but in other cases there will be more than 1 row.



When you run the file you will see an asterisk and then the number .02*. When you comment out the line "%>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")" the astersik goes away so it has something to do with collapse rows. How can this be fixed given that I'd like to keep the collapse rows code because in other cases there are more than 1 row and it works. I tried conditionally excluding with the if statement but that did not work.



---
author:
- ""
classoption: landscape
output:
pdf_document:
number_sections: false
dev: pdf
keep_tex: no
toc: yes
toc_depth: 3
fig.pos: H
fig.width: 11in
fontsize: 9pt
geometry: "left=1cm,right=1cm,top=1cm,bottom=1cm"
fig.lp: 'Fig '
setspace: singlespacing
always_allow_html: yes
header-includes:
- usepackage{amsmath}
- usepackage{rotating}
- usepackage{float}
- usepackage{longtable}
- usepackage{tabulary}
- usepackage{array}
- usepackage{colortbl}
- usepackage{graphicx}
- usepackage{booktabs}
- usepackage{multirow}
- usepackage[table]{xcolor}
- usepackage{wrapfig}
- usepackage{pdflscape}
- usepackage{tabu}
- usepackage{threeparttable}
- usepackage{threeparttablex}
- usepackage[normalem]{ulem}
- usepackage{makecell}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r test}
library(kableExtra)
library(dplyr)
d = data.frame(g = c("A"),v = c(.02))%>%
dplyr::mutate(

v = cell_spec(v,
color = ifelse(is.na(v),"black", ifelse( abs(v) >= 1, "red", "black")),
bold= ifelse(is.na(v),FALSE, ifelse( abs(v) >= .1, TRUE, FALSE)) )

)%>%
dplyr::rename("test"="v" )

kable(
d,
format ="latex",
caption = "test",
booktabs = T,
longtable = T,
escape = F,
align = "c",
linesep=""
) %>% kable_styling(latex_options = c(
"repeat_header"
),
font_size=8) %>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")

#%>% {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle")} #this does not work



```









share|improve this question





























    4















    In the rmarkdown file below I am trying to use collapse rows. IN this case there is only 1 row but in other cases there will be more than 1 row.



    When you run the file you will see an asterisk and then the number .02*. When you comment out the line "%>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")" the astersik goes away so it has something to do with collapse rows. How can this be fixed given that I'd like to keep the collapse rows code because in other cases there are more than 1 row and it works. I tried conditionally excluding with the if statement but that did not work.



    ---
    author:
    - ""
    classoption: landscape
    output:
    pdf_document:
    number_sections: false
    dev: pdf
    keep_tex: no
    toc: yes
    toc_depth: 3
    fig.pos: H
    fig.width: 11in
    fontsize: 9pt
    geometry: "left=1cm,right=1cm,top=1cm,bottom=1cm"
    fig.lp: 'Fig '
    setspace: singlespacing
    always_allow_html: yes
    header-includes:
    - usepackage{amsmath}
    - usepackage{rotating}
    - usepackage{float}
    - usepackage{longtable}
    - usepackage{tabulary}
    - usepackage{array}
    - usepackage{colortbl}
    - usepackage{graphicx}
    - usepackage{booktabs}
    - usepackage{multirow}
    - usepackage[table]{xcolor}
    - usepackage{wrapfig}
    - usepackage{pdflscape}
    - usepackage{tabu}
    - usepackage{threeparttable}
    - usepackage{threeparttablex}
    - usepackage[normalem]{ulem}
    - usepackage{makecell}
    ---

    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE)
    ```

    ```{r test}
    library(kableExtra)
    library(dplyr)
    d = data.frame(g = c("A"),v = c(.02))%>%
    dplyr::mutate(

    v = cell_spec(v,
    color = ifelse(is.na(v),"black", ifelse( abs(v) >= 1, "red", "black")),
    bold= ifelse(is.na(v),FALSE, ifelse( abs(v) >= .1, TRUE, FALSE)) )

    )%>%
    dplyr::rename("test"="v" )

    kable(
    d,
    format ="latex",
    caption = "test",
    booktabs = T,
    longtable = T,
    escape = F,
    align = "c",
    linesep=""
    ) %>% kable_styling(latex_options = c(
    "repeat_header"
    ),
    font_size=8) %>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")

    #%>% {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle")} #this does not work



    ```









    share|improve this question



























      4












      4








      4








      In the rmarkdown file below I am trying to use collapse rows. IN this case there is only 1 row but in other cases there will be more than 1 row.



      When you run the file you will see an asterisk and then the number .02*. When you comment out the line "%>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")" the astersik goes away so it has something to do with collapse rows. How can this be fixed given that I'd like to keep the collapse rows code because in other cases there are more than 1 row and it works. I tried conditionally excluding with the if statement but that did not work.



      ---
      author:
      - ""
      classoption: landscape
      output:
      pdf_document:
      number_sections: false
      dev: pdf
      keep_tex: no
      toc: yes
      toc_depth: 3
      fig.pos: H
      fig.width: 11in
      fontsize: 9pt
      geometry: "left=1cm,right=1cm,top=1cm,bottom=1cm"
      fig.lp: 'Fig '
      setspace: singlespacing
      always_allow_html: yes
      header-includes:
      - usepackage{amsmath}
      - usepackage{rotating}
      - usepackage{float}
      - usepackage{longtable}
      - usepackage{tabulary}
      - usepackage{array}
      - usepackage{colortbl}
      - usepackage{graphicx}
      - usepackage{booktabs}
      - usepackage{multirow}
      - usepackage[table]{xcolor}
      - usepackage{wrapfig}
      - usepackage{pdflscape}
      - usepackage{tabu}
      - usepackage{threeparttable}
      - usepackage{threeparttablex}
      - usepackage[normalem]{ulem}
      - usepackage{makecell}
      ---

      ```{r setup, include=FALSE}
      knitr::opts_chunk$set(echo = TRUE)
      ```

      ```{r test}
      library(kableExtra)
      library(dplyr)
      d = data.frame(g = c("A"),v = c(.02))%>%
      dplyr::mutate(

      v = cell_spec(v,
      color = ifelse(is.na(v),"black", ifelse( abs(v) >= 1, "red", "black")),
      bold= ifelse(is.na(v),FALSE, ifelse( abs(v) >= .1, TRUE, FALSE)) )

      )%>%
      dplyr::rename("test"="v" )

      kable(
      d,
      format ="latex",
      caption = "test",
      booktabs = T,
      longtable = T,
      escape = F,
      align = "c",
      linesep=""
      ) %>% kable_styling(latex_options = c(
      "repeat_header"
      ),
      font_size=8) %>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")

      #%>% {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle")} #this does not work



      ```









      share|improve this question
















      In the rmarkdown file below I am trying to use collapse rows. IN this case there is only 1 row but in other cases there will be more than 1 row.



      When you run the file you will see an asterisk and then the number .02*. When you comment out the line "%>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")" the astersik goes away so it has something to do with collapse rows. How can this be fixed given that I'd like to keep the collapse rows code because in other cases there are more than 1 row and it works. I tried conditionally excluding with the if statement but that did not work.



      ---
      author:
      - ""
      classoption: landscape
      output:
      pdf_document:
      number_sections: false
      dev: pdf
      keep_tex: no
      toc: yes
      toc_depth: 3
      fig.pos: H
      fig.width: 11in
      fontsize: 9pt
      geometry: "left=1cm,right=1cm,top=1cm,bottom=1cm"
      fig.lp: 'Fig '
      setspace: singlespacing
      always_allow_html: yes
      header-includes:
      - usepackage{amsmath}
      - usepackage{rotating}
      - usepackage{float}
      - usepackage{longtable}
      - usepackage{tabulary}
      - usepackage{array}
      - usepackage{colortbl}
      - usepackage{graphicx}
      - usepackage{booktabs}
      - usepackage{multirow}
      - usepackage[table]{xcolor}
      - usepackage{wrapfig}
      - usepackage{pdflscape}
      - usepackage{tabu}
      - usepackage{threeparttable}
      - usepackage{threeparttablex}
      - usepackage[normalem]{ulem}
      - usepackage{makecell}
      ---

      ```{r setup, include=FALSE}
      knitr::opts_chunk$set(echo = TRUE)
      ```

      ```{r test}
      library(kableExtra)
      library(dplyr)
      d = data.frame(g = c("A"),v = c(.02))%>%
      dplyr::mutate(

      v = cell_spec(v,
      color = ifelse(is.na(v),"black", ifelse( abs(v) >= 1, "red", "black")),
      bold= ifelse(is.na(v),FALSE, ifelse( abs(v) >= .1, TRUE, FALSE)) )

      )%>%
      dplyr::rename("test"="v" )

      kable(
      d,
      format ="latex",
      caption = "test",
      booktabs = T,
      longtable = T,
      escape = F,
      align = "c",
      linesep=""
      ) %>% kable_styling(latex_options = c(
      "repeat_header"
      ),
      font_size=8) %>% collapse_rows(columns = 1, latex_hline = "major", valign = "middle")

      #%>% {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle")} #this does not work



      ```






      r-markdown






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 28 '18 at 17:38







      user3022875

















      asked Nov 21 '18 at 21:04









      user3022875user3022875

      2,6201157104




      2,6201157104
























          1 Answer
          1






          active

          oldest

          votes


















          0














          This is a work around:



          .... {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle") else . } %>%






          share|improve this answer
























            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%2f53420458%2fasterisk-is-appearing-when-using-collapse-rows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            This is a work around:



            .... {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle") else . } %>%






            share|improve this answer




























              0














              This is a work around:



              .... {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle") else . } %>%






              share|improve this answer


























                0












                0








                0







                This is a work around:



                .... {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle") else . } %>%






                share|improve this answer













                This is a work around:



                .... {if(nrow(d)>1) collapse_rows(columns = 1, latex_hline = "major", valign = "middle") else . } %>%







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 2 at 18:58









                user3022875user3022875

                2,6201157104




                2,6201157104
































                    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%2f53420458%2fasterisk-is-appearing-when-using-collapse-rows%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

                    How to change which sound is reproduced for terminal bell?

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents