[R-br] Formatação de summary table no RStudio apresentando &nbsp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[R-br] Formatação de summary table no RStudio apresentando &nbsp

R-br mailing list
Estou testando o pacote "qwraps2", então estou rodando o exemplo em: https://github.com/r-lib/xml2/issues/151, conforme abaixo.

set.seed(42)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(qwraps2)

# define the markup language we are working in.
# options(qwraps2_markup = "latex") is also supported.
options(qwraps2_markup = "markdown")

data(mtcars)
mtcars2 <-dplyr::mutate(mtcars, cyl_factor = factor(cyl,levels = c(6, 4, 8), labels = paste(c(6, 4, 8), "cylinders")),
                        cyl_character = paste(cyl, "cylinders"))
our_summary1 <-
  list("Miles Per Gallon" =
         list("min" = ~ min(mpg),
              "max" = ~ max(mpg),
              "mean (sd)" = ~ qwraps2::mean_sd(mpg)),
       "Displacement" =
         list("min" = ~ min(disp),
              "max" = ~ max(disp),
              "mean (sd)" = ~ qwraps2::mean_sd(disp)),
       "Weight (1000 lbs)" =
         list("min" = ~ min(wt),
              "max" = ~ max(wt),
              "mean (sd)" = ~ qwraps2::mean_sd(wt)),
       "Forward Gears" =
         list("Three" = ~ qwraps2::n_perc0(gear == 3),
              "Four"  = ~ qwraps2::n_perc0(gear == 4),
              "Five"  = ~ qwraps2::n_perc0(gear == 5))
  )
our_summary1

### Overall
summary_table(mtcars2, our_summary1)

O código foi executado com sucesso no RStudio, porém a tabela aparece como:
Screenshot from 2018-08-04 18-29-38.png
Como faço para aparecer a tabela formatada como no exemplo:
Screenshot from 2018-08-04 18-31-38.png

--
In Jesu et Maria

Obrigado
Prof. Elias Carvalho

"Felix, qui potuit rerum cognoscere causas" (Virgil 29 BC)
"Blessed is he who has been able to understand the cause of things"

_______________________________________________
R-br mailing list
[hidden email]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo m�nimo reproduz�vel.
Reply | Threaded
Open this post in threaded view
|

Re: [R-br] Formatação de summary table no RStudio apresentando &nbsp

R-br mailing list
Elias, supondo que esteja usando Rmarkdown, experimente especificar 
o argumento results = 'asis', no chunck:

```{r, results='asis'}
# código do e-mail
```

Att.


On Sat, Aug 4, 2018 at 6:36 PM, Elias Carvalho via R-br <[hidden email]> wrote:
Estou testando o pacote "qwraps2", então estou rodando o exemplo em: https://github.com/r-lib/xml2/issues/151, conforme abaixo.

set.seed(42)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(qwraps2)

# define the markup language we are working in.
# options(qwraps2_markup = "latex") is also supported.
options(qwraps2_markup = "markdown")

data(mtcars)
mtcars2 <-dplyr::mutate(mtcars, cyl_factor = factor(cyl,levels = c(6, 4, 8), labels = paste(c(6, 4, 8), "cylinders")),
                        cyl_character = paste(cyl, "cylinders"))
our_summary1 <-
  list("Miles Per Gallon" =
         list("min" = ~ min(mpg),
              "max" = ~ max(mpg),
              "mean (sd)" = ~ qwraps2::mean_sd(mpg)),
       "Displacement" =
         list("min" = ~ min(disp),
              "max" = ~ max(disp),
              "mean (sd)" = ~ qwraps2::mean_sd(disp)),
       "Weight (1000 lbs)" =
         list("min" = ~ min(wt),
              "max" = ~ max(wt),
              "mean (sd)" = ~ qwraps2::mean_sd(wt)),
       "Forward Gears" =
         list("Three" = ~ qwraps2::n_perc0(gear == 3),
              "Four"  = ~ qwraps2::n_perc0(gear == 4),
              "Five"  = ~ qwraps2::n_perc0(gear == 5))
  )
our_summary1

### Overall
summary_table(mtcars2, our_summary1)

O código foi executado com sucesso no RStudio, porém a tabela aparece como:
Screenshot from 2018-08-04 18-29-38.png
Como faço para aparecer a tabela formatada como no exemplo:
Screenshot from 2018-08-04 18-31-38.png

--
In Jesu et Maria

Obrigado
Prof. Elias Carvalho

"Felix, qui potuit rerum cognoscere causas" (Virgil 29 BC)
"Blessed is he who has been able to understand the cause of things"

_______________________________________________
R-br mailing list
[hidden email]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.



--
###############################################################
##  Jônatan Dupont Tatsch
##  Professor do Departamento de Física
##  Centro de Ciências Exatas e Naturais (CCNE)
##  Universidade Federal de Santa Maria - UFSM
##  Faixa de Camobi, Prédio 13 - Campus UFSM - Santa Maria, RS, Brasil - 97105-900
##  Telefone: +55(55)33012083
###############################################################

_______________________________________________
R-br mailing list
[hidden email]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo m�nimo reproduz�vel.
Reply | Threaded
Open this post in threaded view
|

Re: [R-br] Formatação de summary table no RStudio apresentando &nbsp

R-br mailing list
In reply to this post by R-br mailing list
O pacote DT eh been interessante.

Daniel

On Sat, 4 Aug 2018, 18:36 Elias Carvalho via R-br, <[hidden email]> wrote:
Estou testando o pacote "qwraps2", então estou rodando o exemplo em: https://github.com/r-lib/xml2/issues/151, conforme abaixo.

set.seed(42)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(qwraps2)

# define the markup language we are working in.
# options(qwraps2_markup = "latex") is also supported.
options(qwraps2_markup = "markdown")

data(mtcars)
mtcars2 <-dplyr::mutate(mtcars, cyl_factor = factor(cyl,levels = c(6, 4, 8), labels = paste(c(6, 4, 8), "cylinders")),
                        cyl_character = paste(cyl, "cylinders"))
our_summary1 <-
  list("Miles Per Gallon" =
         list("min" = ~ min(mpg),
              "max" = ~ max(mpg),
              "mean (sd)" = ~ qwraps2::mean_sd(mpg)),
       "Displacement" =
         list("min" = ~ min(disp),
              "max" = ~ max(disp),
              "mean (sd)" = ~ qwraps2::mean_sd(disp)),
       "Weight (1000 lbs)" =
         list("min" = ~ min(wt),
              "max" = ~ max(wt),
              "mean (sd)" = ~ qwraps2::mean_sd(wt)),
       "Forward Gears" =
         list("Three" = ~ qwraps2::n_perc0(gear == 3),
              "Four"  = ~ qwraps2::n_perc0(gear == 4),
              "Five"  = ~ qwraps2::n_perc0(gear == 5))
  )
our_summary1

### Overall
summary_table(mtcars2, our_summary1)

O código foi executado com sucesso no RStudio, porém a tabela aparece como:
Screenshot from 2018-08-04 18-29-38.png
Como faço para aparecer a tabela formatada como no exemplo:
Screenshot from 2018-08-04 18-31-38.png

--
In Jesu et Maria

Obrigado
Prof. Elias Carvalho

"Felix, qui potuit rerum cognoscere causas" (Virgil 29 BC)
"Blessed is he who has been able to understand the cause of things"
_______________________________________________
R-br mailing list
[hidden email]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.

_______________________________________________
R-br mailing list
[hidden email]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo m�nimo reproduz�vel.