<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>GF&#39;s blog</title>
<link>https://gustavofrosi.com.br/rss.html</link>
<atom:link href="https://gustavofrosi.com.br/rss.xml" rel="self" type="application/rss+xml"/>
<description>The blog</description>
<language>pt</language>
<generator>quarto-1.9.36</generator>
<lastBuildDate>Sun, 31 Aug 2025 03:00:00 GMT</lastBuildDate>
<item>
  <title>Gráficos para Revista Brasileira de Ciência do Solo</title>
  <dc:creator>Gustavo Frosi</dc:creator>
  <link>https://gustavofrosi.com.br/recap/2025-08-31 RBCS no ggplo2/</link>
  <description><![CDATA[ 





<section id="alguns-padrões" class="level1">
<h1>Alguns padrões</h1>
<p>A <em>Revista Brasileira de Ciência do Solo</em> preza por um padrão gráfico nos artigos publicados. Para isso, há um guia com todas as exigências que os autores devem atender para manter a identidade visual. Este texto é um guia de como realizar essas alterações utilizando gráficos e figuras desenvolvidos com a linguagem R.</p>
<section id="a-fonte" class="level2">
<h2 class="anchored" data-anchor-id="a-fonte">A fonte</h2>
<p><strong>DejaVu</strong> é a família da fonte <strong>DejaVu Sans Condensed</strong>, a qual deve ser utilizada na criação das figuras. A família de fontes <strong>DejaVu</strong> está em domínio público, podendo ser baixada e até modificada por qualquer pessoa. Isso é uma vantagem, pois seu download pode ser feito de forma rápida e simples. Uma das alternativas é obtê-la no site <a href="https://pt.fonts2u.com/dejavu-sans-condensed.fonte">fonts2u</a>.</p>
<p>A Tabela&nbsp;1 mostra o mesmo texto escrito com as fontes Arial e DejaVu, permitindo observar as principais diferenças entre elas.</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(gt)</span>
<span id="cb1-2"></span>
<span id="cb1-3">texto <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Arial =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A ciência do solo é o estudo do solo da Terra e de outros planetas, usando teorias e conhecimentos em evolução para entender seu papel na sustentação do funcionamento do ecossistema, enfrentando desafios ambientais e apoiando a humanidade."</span>,</span>
<span id="cb1-4">                    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">DejaVu =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A ciência do solo é o estudo do solo da Terra e de outros planetas, usando teorias e conhecimentos em evolução para entender seu papel na sustentação do funcionamento do ecossistema, enfrentando desafios ambientais e apoiando a humanidade."</span>)</span>
<span id="cb1-5"></span>
<span id="cb1-6">texto <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-8">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># tab_header(</span></span>
<span id="cb1-9">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   # title = md("**Diferenças entre Arial e DejaVu**")</span></span>
<span id="cb1-10">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ) |&gt; </span></span>
<span id="cb1-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb1-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fonte: https://doi.org/10.1016/j.soisec.2025.100176"</span>)</span>
<span id="cb1-13">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-14">   <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">font =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Arial"</span>),</span>
<span id="cb1-16">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> Arial)</span>
<span id="cb1-17">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">font =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"DejaVu Sans"</span>),</span>
<span id="cb1-20">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> DejaVu)</span>
<span id="cb1-21">  )</span></code></pre></div></div>
</details>
<div id="tbl-comp" class="cell quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-comp-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Tabela&nbsp;1: Comparação das fontes Arial e DejaVu
</figcaption>
<div aria-describedby="tbl-comp-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<div id="rgrygdtegw" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#rgrygdtegw table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#rgrygdtegw thead, #rgrygdtegw tbody, #rgrygdtegw tfoot, #rgrygdtegw tr, #rgrygdtegw td, #rgrygdtegw th {
  border-style: none;
}

#rgrygdtegw p {
  margin: 0;
  padding: 0;
}

#rgrygdtegw .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#rgrygdtegw .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#rgrygdtegw .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#rgrygdtegw .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#rgrygdtegw .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#rgrygdtegw .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#rgrygdtegw .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#rgrygdtegw .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#rgrygdtegw .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#rgrygdtegw .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#rgrygdtegw .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#rgrygdtegw .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#rgrygdtegw .gt_spanner_row {
  border-bottom-style: hidden;
}

#rgrygdtegw .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#rgrygdtegw .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#rgrygdtegw .gt_from_md > :first-child {
  margin-top: 0;
}

#rgrygdtegw .gt_from_md > :last-child {
  margin-bottom: 0;
}

#rgrygdtegw .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#rgrygdtegw .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#rgrygdtegw .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#rgrygdtegw .gt_row_group_first td {
  border-top-width: 2px;
}

#rgrygdtegw .gt_row_group_first th {
  border-top-width: 2px;
}

#rgrygdtegw .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#rgrygdtegw .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#rgrygdtegw .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#rgrygdtegw .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#rgrygdtegw .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#rgrygdtegw .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#rgrygdtegw .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#rgrygdtegw .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#rgrygdtegw .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#rgrygdtegw .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#rgrygdtegw .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#rgrygdtegw .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#rgrygdtegw .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#rgrygdtegw .gt_left {
  text-align: left;
}

#rgrygdtegw .gt_center {
  text-align: center;
}

#rgrygdtegw .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#rgrygdtegw .gt_font_normal {
  font-weight: normal;
}

#rgrygdtegw .gt_font_bold {
  font-weight: bold;
}

#rgrygdtegw .gt_font_italic {
  font-style: italic;
}

#rgrygdtegw .gt_super {
  font-size: 65%;
}

#rgrygdtegw .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#rgrygdtegw .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#rgrygdtegw .gt_indent_1 {
  text-indent: 5px;
}

#rgrygdtegw .gt_indent_2 {
  text-indent: 10px;
}

#rgrygdtegw .gt_indent_3 {
  text-indent: 15px;
}

#rgrygdtegw .gt_indent_4 {
  text-indent: 20px;
}

#rgrygdtegw .gt_indent_5 {
  text-indent: 25px;
}

#rgrygdtegw .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#rgrygdtegw div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>

<table class="gt_table cell caption-top table table-sm table-striped small" data-quarto-bootstrap="false">
<thead>
<tr class="gt_col_headings header">
<th id="Arial" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">Arial</th>
<th id="DejaVu" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">DejaVu</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers="Arial" style="font-family: Arial">A ciência do solo é o estudo do solo da Terra e de outros planetas, usando teorias e conhecimentos em evolução para entender seu papel na sustentação do funcionamento do ecossistema, enfrentando desafios ambientais e apoiando a humanidade.</td>
<td class="gt_row gt_left" headers="DejaVu" style="font-family: 'DejaVu Sans'">A ciência do solo é o estudo do solo da Terra e de outros planetas, usando teorias e conhecimentos em evolução para entender seu papel na sustentação do funcionamento do ecossistema, enfrentando desafios ambientais e apoiando a humanidade.</td>
</tr>
</tbody><tfoot>
<tr class="gt_sourcenotes odd">
<td colspan="2" class="gt_sourcenote">Fonte: https://doi.org/10.1016/j.soisec.2025.100176</td>
</tr>
</tfoot>

</table>

</div>
</div>
</div>
</figure>
</div>
</div>
</section>
<section id="as-cores" class="level2">
<h2 class="anchored" data-anchor-id="as-cores">As cores</h2>
<p>A <em>RBCS</em> possui uma paleta própria com 9 cores disponíveis para os gráficos. Na Figura&nbsp;1 são apresentadas as cores e seus respectivos códigos hexadecimais.</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggplot2)</span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># vetor de cores</span></span>
<span id="cb2-4">cores <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb2-5">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#9e2943"</span>,</span>
<span id="cb2-6">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#0a6c69"</span>,</span>
<span id="cb2-7">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#75a741"</span>,</span>
<span id="cb2-8">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#d18525"</span>,</span>
<span id="cb2-9">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#d86c67"</span>,</span>
<span id="cb2-10">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#5ab5b2"</span>,</span>
<span id="cb2-11">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#b1d369"</span>,</span>
<span id="cb2-12">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#711011"</span>,</span>
<span id="cb2-13">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#033a39"</span></span>
<span id="cb2-14">)</span>
<span id="cb2-15"></span>
<span id="cb2-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># cria um data frame com posição e cores</span></span>
<span id="cb2-17">df <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb2-18">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">seq_along</span>(cores),</span>
<span id="cb2-19">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="cb2-20">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">cor =</span> cores</span>
<span id="cb2-21">)</span>
<span id="cb2-22"></span>
<span id="cb2-23"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># plota quadrados</span></span>
<span id="cb2-24"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(df, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> x, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> y, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> cor)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-25">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_tile</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">width =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">height =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-26">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> cores), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fontface =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_fill_identity</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-28">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_fixed</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-29">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_void</span>()</span></code></pre></div></div>
</details>
<div class="cell-output-display">
<div id="fig-paleta" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-paleta-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2025-08-31 RBCS no ggplo2/index_files/figure-html/fig-paleta-1.png" class="img-fluid figure-img" width="672">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-paleta-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;1: Paleta de cores da RBCS
</figcaption>
</figure>
</div>
</div>
</div>
</section>
</section>
<section id="reproduzindo-o-padrão-rbcs-no-r" class="level1">
<h1>Reproduzindo o padrão RBCS no R</h1>
<p>Para implementar essas configurações, serão utilizados os seguintes pacotes do R:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse) </span>
<span id="cb3-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(systemfonts)</span>
<span id="cb3-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(extrafont)</span>
<span id="cb3-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(patchwork)</span></code></pre></div></div>
</div>
<section id="verificando-a-fonte" class="level2">
<h2 class="anchored" data-anchor-id="verificando-a-fonte">Verificando a fonte</h2>
<p>Após baixar e instalar a fonte, é necessário torná-la disponível para uso no R. Isso é feito carregando as fontes do sistema com a função abaixo:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># importar fontes</span></span>
<span id="cb4-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">font_import</span>()</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system.
Continue? [y/n] </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Exiting.</code></pre>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>A função <code>font_import()</code> é utilizada apenas um vez, após a instalação da fonte no computador.</p>
</div>
</div>
<p>Após o carregamento, pode ser realizado o registro de fontes que ainda não foram registradas.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># registrar fontes</span></span>
<span id="cb7-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loadfonts</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">device =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"win"</span>)</span></code></pre></div></div>
</div>
<p>Agora, as fontes podem ser carregadas, e uma estrutura condicional pode ser feita para verificar se entre as fontes disponíveis está a <strong>DejaVu</strong>.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fontes detectadas no sistema</span></span>
<span id="cb8-2">fonts <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">system_fonts</span>()</span>
<span id="cb8-3"></span>
<span id="cb8-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># estrutura lógica de seleção</span></span>
<span id="cb8-5"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">any</span>(fonts <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"DejaVuSansCondensed"</span>)) {</span>
<span id="cb8-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fonte instalada!!"</span>)</span>
<span id="cb8-7">}<span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">else</span>{</span>
<span id="cb8-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fonte não encontrada!!"</span>)</span>
<span id="cb8-9">}</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Fonte instalada!!"</code></pre>
</div>
</div>
</section>
<section id="cores" class="level2">
<h2 class="anchored" data-anchor-id="cores">Cores</h2>
<p>Para utilizar as cores, basta criar um vetor com os códigos hexadecimais (Figura&nbsp;1).</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1">cores <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb10-2">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#9e2943"</span>,</span>
<span id="cb10-3">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#0a6c69"</span>,</span>
<span id="cb10-4">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#75a741"</span>,</span>
<span id="cb10-5">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#d18525"</span>,</span>
<span id="cb10-6">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#d86c67"</span>,</span>
<span id="cb10-7">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#5ab5b2"</span>,</span>
<span id="cb10-8">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#b1d369"</span>,</span>
<span id="cb10-9">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#711011"</span>,</span>
<span id="cb10-10">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#033a39"</span></span>
<span id="cb10-11">)</span></code></pre></div></div>
</div>
</section>
<section id="exemplo-de-uso" class="level2">
<h2 class="anchored" data-anchor-id="exemplo-de-uso">Exemplo de uso</h2>
<p>A seguir, apresento um exemplo de como tudo isso pode ser adicionado de forma simples aos gráficos.</p>
<p>Para ilustrar, criei dados fictícios de um experimento comum de dose e resposta. Neste exemplo, considero 9 tratamentos, com 10 repetições, 5 doses e uma variável chamada resposta. Os valores não possuem significado real, servindo apenas como exemplo.</p>
</section>
<section id="visualização" class="level2">
<h2 class="anchored" data-anchor-id="visualização">Visualização</h2>
<p>Para aplicar a fonte a todo o texto do gráfico, basta definir o nome da fonte na configuração de temas do {ggplot2}.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb11" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dejavu Sans"</span>)</span></code></pre></div></div>
</div>
<p>Caso, o tema utilizado seja o “base”, utilize:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dejavu Sans"</span>))</span></code></pre></div></div>
</div>
<p>Já as cores podem ser adicionadas por meio de uma escala manual, passando o vetor como parâmetro de <code>values</code> na função <code>scale_color_manual()</code>.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb13" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb13-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(df) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb13-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> tratamento, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> resposta, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(dose)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb13-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stat_summary</span>(</span>
<span id="cb13-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">geom =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"errorbar"</span>,</span>
<span id="cb13-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">position_dodge</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb13-6">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb13-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stat_summary</span>(</span>
<span id="cb13-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">geom =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"point"</span>,</span>
<span id="cb13-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">position_dodge</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>),</span>
<span id="cb13-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb13-11">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb13-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_color_manual</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values =</span> cores)</span></code></pre></div></div>
</div>
<p>Além disso, a RBCS solicita que os gráficos sejam enviados em formato vetorial, como SVG. Para salvar um gráfico do {ggplot2} nesse formato, basta utilizar a função <code>ggsave()</code>.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb14-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsave</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">filename =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fig_ex.svg"</span>, </span>
<span id="cb14-2">       <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">width =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, </span>
<span id="cb14-3">       <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">height =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>, </span>
<span id="cb14-4">       <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">units =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cm"</span>, </span>
<span id="cb14-5">       <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">dpi =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">950</span>)</span></code></pre></div></div>
</div>
<p>Abaixo, reúno os dados apresentados em três gráficos distintos, já utilizando as configurações da <em>RBCS</em>.</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb15" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ponto com barra de erro</span></span>
<span id="cb15-2">p1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(df) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> tratamento, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> resposta, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(dose)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stat_summary</span>(</span>
<span id="cb15-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">geom =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"errorbar"</span>,</span>
<span id="cb15-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">position_dodge</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb15-7">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stat_summary</span>(</span>
<span id="cb15-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">geom =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"point"</span>,</span>
<span id="cb15-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">position_dodge</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>),</span>
<span id="cb15-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb15-12">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_color_manual</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values =</span> cores) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb15-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Tratamento"</span>,</span>
<span id="cb15-16">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Resposta"</span>,</span>
<span id="cb15-17">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dose"</span>,</span>
<span id="cb15-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gráfico de pontos de exemplo"</span></span>
<span id="cb15-19">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dejavu Sans"</span>)</span>
<span id="cb15-21"></span>
<span id="cb15-22"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># colunas</span></span>
<span id="cb15-23">p2 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(df) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-24">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> dose, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> resposta, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(tratamento)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-25">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stat_summary</span>(</span>
<span id="cb15-26">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">geom =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"col"</span>,</span>
<span id="cb15-27">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">position_dodge</span>()</span>
<span id="cb15-28">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-29">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_fill_manual</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values =</span> cores) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-30">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb15-31">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dose"</span>,</span>
<span id="cb15-32">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Resposta"</span>,</span>
<span id="cb15-33">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Tratamento"</span>,</span>
<span id="cb15-34">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gráfico de barras de exemplo"</span></span>
<span id="cb15-35">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-36">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dejavu Sans"</span>)</span>
<span id="cb15-37"></span>
<span id="cb15-38"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># linhas</span></span>
<span id="cb15-39">p3 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(df) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-40">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> dose, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> resposta, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(tratamento)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-41">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stat_summary</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">geom =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"line"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-42">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_color_manual</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values =</span> cores) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-43">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb15-44">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dose"</span>,</span>
<span id="cb15-45">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Resposta"</span>,</span>
<span id="cb15-46">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Tratamento"</span>,</span>
<span id="cb15-47">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gráfico de linhas de exemplo"</span></span>
<span id="cb15-48">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb15-49">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dejavu Sans"</span>)</span>
<span id="cb15-50"></span>
<span id="cb15-51">pt1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> (p1 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> p2) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot_layout</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">widths =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">55</span>, .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">45</span>))</span>
<span id="cb15-52"></span>
<span id="cb15-53">ptt <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> pt1 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> p3</span>
<span id="cb15-54"></span>
<span id="cb15-55"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ggsave(filename = "exemplo_gra.png",</span></span>
<span id="cb15-56"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#        width = 10,</span></span>
<span id="cb15-57"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#        height = 8,</span></span>
<span id="cb15-58"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#        dpi = 1200)</span></span></code></pre></div></div>
</details>
</div>
<p><img src="https://gustavofrosi.com.br/recap/2025-08-31 RBCS no ggplo2/ima/exemplo_gra.png" class="img-fluid"></p>
</section>
</section>
<section id="criando-um-snippet" class="level1">
<h1>Criando um snippet</h1>
<p>Os snippets são blocos de código que podem ser chamados rapidamente no corpo do script, utilizando palavras-chave. Exemplos são <code>if</code>, <code>for</code> e <code>fun</code>. Ao digitar essas palavras no RStudio, o autocomplete sugere o snippet que insere automaticamente a estrutura completa da função, otimizando o tempo.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><video src="ima/2025-08-09%2016-56-27.mkv" class="img-fluid" controls=""><a href="ima/2025-08-09 16-56-27.mkv">Video</a></video></p>
<figcaption>Exemplo de uso de snippet</figcaption>
</figure>
</div>
<section id="snippet-rbcs" class="level2">
<h2 class="anchored" data-anchor-id="snippet-rbcs">Snippet rbcs</h2>
<p>O vídeo abaixo mostra o processo de criação de um snippet baseado no código acima, como chamá-lo no script e, assim, automatizar as configurações de gráficos para a <em>RBCS</em>.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><video src="ima/snippet_rbcs.mkv" class="img-fluid" controls=""><a href="ima/snippet_rbcs.mkv">Video</a></video></p>
<figcaption>Exemplo de snippet RBCS</figcaption>
</figure>
</div>
<p>Agora, sempre que for necessário formatar gráficos de acordo com o padrão da <em>RBCS</em>, basta escrever <code>rbcs</code> e pressionar enter no RStudio: as configurações básicas já serão inseridas no código.</p>


</section>
</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> De volta ao topo</a> ]]></description>
  <category>R</category>
  <category>Solos</category>
  <category>RBCS</category>
  <category>ggplot2</category>
  <guid>https://gustavofrosi.com.br/recap/2025-08-31 RBCS no ggplo2/</guid>
  <pubDate>Sun, 31 Aug 2025 03:00:00 GMT</pubDate>
  <media:content url="https://gustavofrosi.com.br/recap/2025-08-31 RBCS no ggplo2/th.png" medium="image" type="image/png" height="78" width="144"/>
</item>
<item>
  <title>Trabalhos - XV Reunião Sul Brasileira de Ciência do Solo</title>
  <dc:creator>Gustavo Frosi</dc:creator>
  <link>https://gustavofrosi.com.br/recap/2025-01-05 RSBCS 2024/</link>
  <description><![CDATA[ 





<section id="introdução" class="level1">
<h1>Introdução</h1>
<p>Para mais informações acesse o site: <a href="https://www.rsbcs2024.com.br/" class="uri">https://www.rsbcs2024.com.br/</a></p>
</section>
<section id="pacotes" class="level1">
<h1>Pacotes</h1>
<p>Para essa análise vou utilizar os seguintes pacotes do R</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(pdftools)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggtext)</span>
<span id="cb1-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(gt)</span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(patchwork)</span></code></pre></div></div>
</details>
</div>
</section>
<section id="dados" class="level1">
<h1>Dados</h1>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1">doc <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"anais-2024.pdf"</span></span>
<span id="cb2-2"></span>
<span id="cb2-3">texto <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> pdftools<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pdf_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pdf =</span> doc)</span>
<span id="cb2-4"></span>
<span id="cb2-5">df <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> texto[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>] <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_split</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"(?&lt;=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d)</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">n"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unlist</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">enframe</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">name =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">value =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"linha"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(linha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>)</span>
<span id="cb2-10"></span>
<span id="cb2-11">df2 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df[<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">seq</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>),]</span>
<span id="cb2-12">df2 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df2[<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">seq</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">321</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">320</span>),]</span>
<span id="cb2-13"></span>
<span id="cb2-14">base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df2 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">separate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> linha, </span>
<span id="cb2-15">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">into =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"trabalho"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pag"</span>), </span>
<span id="cb2-16">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sep =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">.{2,}</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">s*"</span>)</span>
<span id="cb2-17"></span>
<span id="cb2-18">writexl<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">write_xlsx</span>(base, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">path =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"anais.xlsx"</span>)</span></code></pre></div></div>
</details>
</div>
</section>
<section id="visualização" class="level1">
<h1>Visualização</h1>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">df <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> readxl<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_excel</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"anais.xlsx"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb3-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pag =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(pag))</span>
<span id="cb3-3"></span>
<span id="cb3-4">area <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_detect</span>(trabalho, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ÁREA"</span>))</span>
<span id="cb3-5"></span>
<span id="cb3-6">df_filter <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anti_join</span>(df, area, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">by =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pag"</span>)</span>
<span id="cb3-7"></span>
<span id="cb3-8">areas <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb3-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb3-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">code =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Biologia"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Educação"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Manejo"</span>,</span>
<span id="cb3-11">             <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gênese"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Física"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Química"</span>),</span>
<span id="cb3-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nome =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb3-13">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BIOLOGIA DO SOLO, CICLOS BIOGEOQUÍMICOS, </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">BIOINSUMOS, QUALIDADE E SAÚDE DO SOLO"</span>,</span>
<span id="cb3-14">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"EDUCAÇÃO, SOCIOLOGIA, PÚBLICA E </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">SEGURANÇA ALIMENTAR"</span>,</span>
<span id="cb3-15">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"MANEJO E CONSERVAÇÃO DO SOLO E DA ÁGUA, </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">PLANEJAMENTO DO USO DA TERRA, HIDROLOGIA"</span>,</span>
<span id="cb3-16">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"MINERALOGIA, GÊNESE, MORFOLOGIA, </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">LEVANTAMENTO, CLASSIFICAÇÃO DO SOLO, </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">PEDOMETRIA E PALEOPEDOLOGIA"</span>,</span>
<span id="cb3-17">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PEDOFUNÇÕES, PROPRIEDADES E </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">PROCESSOS FÍSICOS DO SOLO"</span>,</span>
<span id="cb3-18">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"QUÍMICA, FERTILIDADE, NUTRIÇÃO DE PLANTAS, </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> CORRETIVOS E FERTILIZANTES"</span></span>
<span id="cb3-19">      )</span>
<span id="cb3-20">    )</span>
<span id="cb3-21"></span>
<span id="cb3-22">base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df_filter <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb3-23">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">area =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb3-24">    pag <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">103</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Biologia"</span>,</span>
<span id="cb3-25">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">between</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> pag, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">left =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">103</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">122</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Educação"</span>,</span>
<span id="cb3-26">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">between</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> pag, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">left =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">123</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">186</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Manejo"</span>,</span>
<span id="cb3-27">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">between</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> pag, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">left =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">187</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">204</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gênese"</span>,</span>
<span id="cb3-28">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">between</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> pag, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">left =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">205</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">224</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Física"</span>,</span>
<span id="cb3-29">    pag <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">224</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Química"</span>,</span>
<span id="cb3-30">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.default =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span></span>
<span id="cb3-31">  ),</span>
<span id="cb3-32">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">area =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_to_title</span>(area))</span></code></pre></div></div>
</details>
</div>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">areas <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb4-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb4-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_header</span>(</span>
<span id="cb4-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"**Divisão das áreas de pesquisa na XV RSBCS**"</span>),</span>
<span id="cb4-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Reunião Sul Brasileira de Ciência do Solo"</span>)</span>
<span id="cb4-6">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb4-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cols_label</span>(</span>
<span id="cb4-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">code =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Código"</span>,</span>
<span id="cb4-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nome =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Área"</span></span>
<span id="cb4-10">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb4-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb4-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Source: www.rsbcs2024.com.br"</span>)</span>
<span id="cb4-13">  )</span></code></pre></div></div>
</details>
<div class="cell-output-display">
<div id="cspacmqnqa" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#cspacmqnqa table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#cspacmqnqa thead, #cspacmqnqa tbody, #cspacmqnqa tfoot, #cspacmqnqa tr, #cspacmqnqa td, #cspacmqnqa th {
  border-style: none;
}

#cspacmqnqa p {
  margin: 0;
  padding: 0;
}

#cspacmqnqa .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#cspacmqnqa .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#cspacmqnqa .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#cspacmqnqa .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#cspacmqnqa .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#cspacmqnqa .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#cspacmqnqa .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#cspacmqnqa .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#cspacmqnqa .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#cspacmqnqa .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#cspacmqnqa .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#cspacmqnqa .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#cspacmqnqa .gt_spanner_row {
  border-bottom-style: hidden;
}

#cspacmqnqa .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#cspacmqnqa .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#cspacmqnqa .gt_from_md > :first-child {
  margin-top: 0;
}

#cspacmqnqa .gt_from_md > :last-child {
  margin-bottom: 0;
}

#cspacmqnqa .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#cspacmqnqa .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#cspacmqnqa .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#cspacmqnqa .gt_row_group_first td {
  border-top-width: 2px;
}

#cspacmqnqa .gt_row_group_first th {
  border-top-width: 2px;
}

#cspacmqnqa .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#cspacmqnqa .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#cspacmqnqa .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#cspacmqnqa .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#cspacmqnqa .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#cspacmqnqa .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#cspacmqnqa .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#cspacmqnqa .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#cspacmqnqa .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#cspacmqnqa .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#cspacmqnqa .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#cspacmqnqa .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#cspacmqnqa .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#cspacmqnqa .gt_left {
  text-align: left;
}

#cspacmqnqa .gt_center {
  text-align: center;
}

#cspacmqnqa .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#cspacmqnqa .gt_font_normal {
  font-weight: normal;
}

#cspacmqnqa .gt_font_bold {
  font-weight: bold;
}

#cspacmqnqa .gt_font_italic {
  font-style: italic;
}

#cspacmqnqa .gt_super {
  font-size: 65%;
}

#cspacmqnqa .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#cspacmqnqa .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#cspacmqnqa .gt_indent_1 {
  text-indent: 5px;
}

#cspacmqnqa .gt_indent_2 {
  text-indent: 10px;
}

#cspacmqnqa .gt_indent_3 {
  text-indent: 15px;
}

#cspacmqnqa .gt_indent_4 {
  text-indent: 20px;
}

#cspacmqnqa .gt_indent_5 {
  text-indent: 25px;
}

#cspacmqnqa .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#cspacmqnqa div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>

<table class="gt_table caption-top table table-sm table-striped small" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading header">
<td colspan="2" class="gt_heading gt_title gt_font_normal"><strong>Divisão das áreas de pesquisa na XV RSBCS</strong></td>
</tr>
<tr class="gt_heading even">
<td colspan="2" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Reunião Sul Brasileira de Ciência do Solo</td>
</tr>
<tr class="gt_col_headings header">
<th id="code" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">Código</th>
<th id="nome" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">Área</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers="code">Biologia</td>
<td class="gt_row gt_left" headers="nome">BIOLOGIA DO SOLO, CICLOS BIOGEOQUÍMICOS, BIOINSUMOS, QUALIDADE E SAÚDE DO SOLO</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="code">Educação</td>
<td class="gt_row gt_left" headers="nome">EDUCAÇÃO, SOCIOLOGIA, PÚBLICA E SEGURANÇA ALIMENTAR</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="code">Manejo</td>
<td class="gt_row gt_left" headers="nome">MANEJO E CONSERVAÇÃO DO SOLO E DA ÁGUA, PLANEJAMENTO DO USO DA TERRA, HIDROLOGIA</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="code">Gênese</td>
<td class="gt_row gt_left" headers="nome">MINERALOGIA, GÊNESE, MORFOLOGIA, LEVANTAMENTO, CLASSIFICAÇÃO DO SOLO, PEDOMETRIA E PALEOPEDOLOGIA</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="code">Física</td>
<td class="gt_row gt_left" headers="nome">PEDOFUNÇÕES, PROPRIEDADES E PROCESSOS FÍSICOS DO SOLO</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="code">Química</td>
<td class="gt_row gt_left" headers="nome">QUÍMICA, FERTILIDADE, NUTRIÇÃO DE PLANTAS, CORRETIVOS E FERTILIZANTES</td>
</tr>
</tbody><tfoot>
<tr class="gt_sourcenotes odd">
<td colspan="2" class="gt_sourcenote">Source: www.rsbcs2024.com.br</td>
</tr>
</tfoot>

</table>

</div>
</div>
</div>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1">github_icon <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span>  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&amp;#xf09b"</span></span>
<span id="cb5-2">git_gf <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"FGu5tav0"</span></span>
<span id="cb5-3">social_caption <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> glue<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glue</span>(</span>
<span id="cb5-4">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&lt;span style='font-family:</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">Font Awesome 6 Brands</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">;'&gt;{github_icon};&lt;/span&gt;</span></span>
<span id="cb5-5"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  &lt;span style='color: #000000'&gt;{git_gf}&lt;/span&gt;&lt;br&gt; Dados: rsbcs2024.com.br"</span></span>
<span id="cb5-6">)</span>
<span id="cb5-7"></span>
<span id="cb5-8">p1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> base <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(area) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">count</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_reorder</span>(area, n), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> n)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(</span>
<span id="cb5-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#3d643b"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#317a31"</span>,</span>
<span id="cb5-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">width =</span> .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span></span>
<span id="cb5-15">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_color_identity</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mapping=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>area, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span>area),</span>
<span id="cb5-18">            <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray20"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">vjust=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.3</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fontface =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-19">  ggtext<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_textbox</span>(</span>
<span id="cb5-20">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(</span>
<span id="cb5-21">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> n,</span>
<span id="cb5-22">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb5-23">        n <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="cb5-24">        <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb5-25">      ),</span>
<span id="cb5-26">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">halign =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb5-27">        n <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="cb5-28">        <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb5-29">      ),</span>
<span id="cb5-30">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb5-31">        n <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#FFFFFF"</span>,</span>
<span id="cb5-32">        <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#36200d"</span></span>
<span id="cb5-33">      )</span>
<span id="cb5-34">    ),</span>
<span id="cb5-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,</span>
<span id="cb5-36">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>,</span>
<span id="cb5-37">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">box.colour =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>,</span>
<span id="cb5-38">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Cabin"</span>,</span>
<span id="cb5-39">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fontface =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span></span>
<span id="cb5-40">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-41">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">expand =</span> F, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">clip =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"off"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-42">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb5-43">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">' &lt;span style = "color:#317a31"&gt; Resumos apresentados na&lt;/span&gt;&lt;span style = "color:#36200d"&gt; XV RSBCS - 2024&lt;/span&gt;'</span>,</span>
<span id="cb5-44">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Número de resumos apresentados por área"</span>,</span>
<span id="cb5-45">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"nº de trabalhos apresentados"</span>,</span>
<span id="cb5-46">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb5-47">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption =</span> social_caption</span>
<span id="cb5-48">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-49">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">14</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-50">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb5-51">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.background =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_rect</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#f5f5f2"</span>, </span>
<span id="cb5-52">                                   <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#f5f5f2"</span>),</span>
<span id="cb5-53">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>,</span>
<span id="cb5-54">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> ggtext<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_textbox_simple</span>(</span>
<span id="cb5-55">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rel</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.3</span>),</span>
<span id="cb5-56">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">face =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>,</span>
<span id="cb5-57">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Enriqueta"</span>,</span>
<span id="cb5-58">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">lineheight =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="cb5-59">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">margin =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">margin</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"lines"</span>),</span>
<span id="cb5-60">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">halign =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb5-61">    ),</span>
<span id="cb5-62">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> ggtext<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_textbox_simple</span>(</span>
<span id="cb5-63">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Cabin"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rel</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), </span>
<span id="cb5-64">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">lineheight =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="cb5-65">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">margin =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">margin</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"lines"</span>)),</span>
<span id="cb5-66">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.caption =</span> ggtext<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_textbox_simple</span>(</span>
<span id="cb5-67">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rel</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)),</span>
<span id="cb5-68">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">panel.grid.major =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb5-69">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb5-70">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.text=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb5-71">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.ticks =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>()</span>
<span id="cb5-72">  ) </span>
<span id="cb5-73"></span>
<span id="cb5-74"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ggsave(plot = p1,filename = "resumos.jpeg",</span></span>
<span id="cb5-75"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># width = 4, height = 4, dpi = 600)</span></span></code></pre></div></div>
</details>
</div>
<p><img src="https://gustavofrosi.com.br/recap/2025-01-05 RSBCS 2024/resumos.jpeg" class="img-fluid" style="width:80.0%"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>Os códigos apresentados foram produzidos sem critérios de qualidade. Melhorias ainda podem ser feitas.</p>
</div>
</div>


</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> De volta ao topo</a> ]]></description>
  <category>R</category>
  <category>Solos</category>
  <guid>https://gustavofrosi.com.br/recap/2025-01-05 RSBCS 2024/</guid>
  <pubDate>Sun, 05 Jan 2025 03:00:00 GMT</pubDate>
  <media:content url="https://gustavofrosi.com.br/recap/2025-01-05 RSBCS 2024/logo.png" medium="image" type="image/png" height="45" width="144"/>
</item>
<item>
  <title>Do caos ao conhecimento:  use \(y = \beta_{0} + \beta_{1}x + \epsilon\) para explicar seus experimentos</title>
  <dc:creator>Gustavo Frosi</dc:creator>
  <link>https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/</link>
  <description><![CDATA[ 






<section id="aprendi-assim" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> Aprendi assim!</h1>
<p><span style="color: #53868B;"><strong>“Os dados foram analisados por meio da análise de variância e, quando significativo, foram realizadas comparações de médias por Tukey para dados categóricos e regressão para dados quantitativos”</strong></span></p>
<p>Essa é a lógica que eu aprendi durante minha graduação e que se manteve até pelo menos meu mestrado. E não é uma lógica errada, longe disso, mas é muito limitada e responde uma parte dos problemas.</p>
<p>Essa abordagem me transmitia a ideia, ou a sensação, de que era somente dessa forma que os estudos eram realizados. É claro que essa era uma limitação minha ao perceber dessa maneira, mas tenho conduzido algumas pesquisas que me indicam que há um coletivo de pessoas que também pensam assim (isso fica para outro momento).</p>
<p>Neste texto, mostro como a regressão linear pode ser aplicada a dados de natureza contínua e/ou categórica. Além disso, inclui um <a href="regressao_linear.r">tutorial</a> para a implementação em R.</p>
</section>
<section id="a-regressão" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> A regressão</h1>
<p>Francis Galton foi quem desenvolveu o conceito de regressão por volta de 1885. A regressão é utilizada para verificar a relação entre duas ou mais variáveis, de modo que uma delas pode ser descrita, explicada ou predita pelas demais.</p>
<p>A variável que será explicada (<img src="https://latex.codecogs.com/png.latex?y">) é chamada de variável dependente, enquanto a variável que a explica (<img src="https://latex.codecogs.com/png.latex?x">) é denominada variável independente. Isso não significa necessariamente que há uma relação de causa e efeito entre <img src="https://latex.codecogs.com/png.latex?x"> e <img src="https://latex.codecogs.com/png.latex?y">, mas para a análise, considera-se essa dependência entre as variáveis.</p>
<p>Para o <img src="https://latex.codecogs.com/png.latex?y"> em uma regressão linear, é necessário que tenhamos dados do tipo contínuo. No entanto, para o <img src="https://latex.codecogs.com/png.latex?x">, podemos utilizar tanto dados contínuos quanto categóricos.</p>
<p>Uma regressão linear simples pode ser descrita pela equação:</p>
<p><img src="https://latex.codecogs.com/png.latex?y=%5Cbeta_%7B0%7D+%5Cbeta_%7B1%7Dx+%5Cepsilon"> Onde, <img src="https://latex.codecogs.com/png.latex?y"> é a variável dependente; <img src="https://latex.codecogs.com/png.latex?%5Cbeta_%7B0%7D"> é o intercepto do modelo (ponto que corta o eixo <img src="https://latex.codecogs.com/png.latex?y">); <img src="https://latex.codecogs.com/png.latex?%5Cbeta_%7B1%7D"> é o coeficiente angular; <img src="https://latex.codecogs.com/png.latex?x"> é a variável independente e <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> é o erro do modelo (Figura&nbsp;1).</p>
<div class="cell">
<div class="cell-output-display">
<div id="fig-reg" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-reg-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/index_files/figure-html/fig-reg-1.png" class="img-fluid figure-img" width="672">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-reg-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;1: Esquema de representação da regressão linear simples
</figcaption>
</figure>
</div>
</div>
</div>
<section id="como-ela-se-ajusta" class="level2" data-number="2.1">
<h2 data-number="2.1" class="anchored" data-anchor-id="como-ela-se-ajusta"><span class="header-section-number">2.1</span> Como ela se ajusta?</h2>
<p>Para encontrar a curva com o melhor ajuste, é utilizado o método dos mínimos quadrados. Isso significa que o método “encontra” qual das curvas retorna o menor valor para a soma dos quadrados. Essa soma dos quadrados é obtida calculando a diferença entre o valor observado e o valor predito, elevando essa diferença ao quadrado e, somando tudo.</p>
<p>Em outras palavras, esse método encontra “a curva que fica mais próxima dos dados observados”. É claro que a quantidade de matemática e estatística por trás de todo esse método é brutal. Aqui apresento apenas uma explicação superficial.</p>
<p>A Figura&nbsp;2 mostra uma curva (<img src="https://latex.codecogs.com/png.latex?a">) com inclinação zero, que representa o intercepto na média dos valores de <img src="https://latex.codecogs.com/png.latex?y">. Já em <img src="https://latex.codecogs.com/png.latex?b">, temos o melhor ajuste possível para uma regressão linear. A primeira curva pode ser considerada um palpite inicial para explicar os dados, ou seja, utilizando o valor da média. A segunda é um avanço, onde <img src="https://latex.codecogs.com/png.latex?y"> passa a assumir valores dependendo de <img src="https://latex.codecogs.com/png.latex?x">.</p>
<div class="cell">
<div class="cell-output-display">
<div id="fig-reg2" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-reg2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/index_files/figure-html/fig-reg2-1.png" class="img-fluid figure-img" width="672">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-reg2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;2: Ajsute de curva para média de y (a) e ajsute de menor erro (b)
</figcaption>
</figure>
</div>
</div>
</div>
<p>A animação abaixo mostra a reta de regressão assumindo diversos valores para <img src="https://latex.codecogs.com/png.latex?%5Cbeta_%7B0%7D"> e <img src="https://latex.codecogs.com/png.latex?%5Cbeta_%7B1%7D">. É importante observar que ela começa com uma reta na média de <img src="https://latex.codecogs.com/png.latex?y"> e evolui até alcançar retas para além da mais adequada. Os valores da soma dos quadrados indicam que há uma inclinação que minimiza esse valor, enquanto inclinações anteriores ou posteriores fazem com que a soma dos quadrados aumente.</p>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/index_files/figure-html/unnamed-chunk-4-1.gif" class="img-fluid figure-img"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="variável-categórica-na-regressão" class="level2" data-number="2.2">
<h2 data-number="2.2" class="anchored" data-anchor-id="variável-categórica-na-regressão"><span class="header-section-number">2.2</span> Variável categórica na regressão</h2>
<p>Essa é a parte que mais me chama atenção.</p>
<p>Para que uma variável categórica entre na análise de regressão, ela passa por uma pequena transformação, tornando-se uma <strong>variável dummy</strong>.</p>
<p>Por definição, uma variável dummy assume apenas os valores <img src="https://latex.codecogs.com/png.latex?0"> ou <img src="https://latex.codecogs.com/png.latex?1">, indicando a presença ou ausência de uma categoria. O número de variáveis dummy criadas é sempre igual a <img src="https://latex.codecogs.com/png.latex?n-1">, onde <img src="https://latex.codecogs.com/png.latex?n"> é o número de categorias da variável.</p>
<p>Se tivermos <img src="https://latex.codecogs.com/png.latex?3"> grupos em nossa variável, então teremos <img src="https://latex.codecogs.com/png.latex?2"> variáveis dummy, como mostrado na Tabela&nbsp;1. Nota-se que um dos grupos sempre terá o valor <img src="https://latex.codecogs.com/png.latex?0"> em ambas as dummies, pois serve como referência, e os demais grupos serão comparados a ele. Na Tabela&nbsp;1, o grupo “A” é a referência inicial, mas para as demais comparações, é possível alterar o grupo de referência.</p>
<div class="cell">
<div id="tbl-dummy" class="cell quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-dummy-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Tabela&nbsp;1: Representação das variáveis dummy
</figcaption>
<div aria-describedby="tbl-dummy-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<table class="cell caption-top table table-sm table-striped small">
<thead>
<tr class="header">
<th style="text-align: left;">Grupo</th>
<th style="text-align: right;">Dummy (D1)</th>
<th style="text-align: right;">Dummy (D2)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">A (ref)</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
</tr>
<tr class="even">
<td style="text-align: left;">B</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0</td>
</tr>
<tr class="odd">
<td style="text-align: left;">C</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">1</td>
</tr>
</tbody>
</table>
</div>
</div>
</figure>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center collapsed" data-bs-toggle="collapse" data-bs-target=".callout-1-contents" aria-controls="callout-1" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Nota</span>Dummy em programas estatísticos
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-1" class="callout-1-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<p>A criação das variáveis dummy é totalmente automatizada nos programas estatísticos. Logo, você não precisa criá-las manualmente. No entanto, como exercicio, vale a pena rodar uma regressão criando as próprias dummies e ver que o resultado é exatamente o mesmo que o do computador.</p>
</div>
</div>
</div>
<p>A equação de regressão geral pode ser descrita conforme Equação&nbsp;1. Também podemos fazer uma equação para cada grupo (Equação&nbsp;2, Equação&nbsp;3 e Equação&nbsp;4).</p>
<p><span id="eq-dummy"><img src="https://latex.codecogs.com/png.latex?y=%5Cbeta_%7B0%7D+%5Cbeta_%7B1%7DD1+%5Cbeta_%7B2%7DD2+%5Cepsilon_%7Bi%7D%20%5Ctag%7B1%7D"></span></p>
<p>Equação grupo <strong>A</strong>:</p>
<p><span id="eq-dois"><img src="https://latex.codecogs.com/png.latex?y=%5Cbeta_%7B0%7D+%5Cepsilon_%7Bi%7D%20%5Ctag%7B2%7D"></span></p>
<p>Equação grupo <strong>B</strong>:</p>
<p><span id="eq-tres"><img src="https://latex.codecogs.com/png.latex?y=%5Cbeta_%7B0%7D+%5Cbeta_%7B1%7DD1+%5Cepsilon%20%5Ctag%7B3%7D"></span></p>
<p>Equação grupo <strong>C</strong>:</p>
<p><span id="eq-quatro"><img src="https://latex.codecogs.com/png.latex?y=%5Cbeta_%7B0%7D+%5Cbeta_%7B2%7DD2+%5Cepsilon%20%5Ctag%7B4%7D"></span></p>
<p>Agora, repare como a Equação&nbsp;2 é descrita apenas pelo intercepto, pois a variável de grupo assume o valor <img src="https://latex.codecogs.com/png.latex?0"> em todas as dummies (Tabela&nbsp;1). Já para os demais grupos aparece na equaçao as dummies em que o valor <img src="https://latex.codecogs.com/png.latex?1"> é atribuído.</p>
<p>A interpretação de uma regressão com variáveis dummy é, basicamente, a diferença de média entre os grupos (semelhante a um teste de Tukey). Na Figura&nbsp;3, podemos ver as médias dos grupos A, B e C e os respectivos <img src="https://latex.codecogs.com/png.latex?%5Cbeta">s, que indicam a diferença entre elas. Essa diferença pode ser entendida como uma diferença angular, pois, se as médias são diferentes, forma-se um ângulo (<img src="https://latex.codecogs.com/png.latex?%5Cneq%200">) entre as médias.</p>
<div class="cell">
<div class="cell-output-display">
<div id="fig-dummy" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-dummy-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/index_files/figure-html/fig-dummy-1.png" class="img-fluid figure-img" width="672">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-dummy-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;3: Representação esquemática da regressão com variável dummy
</figcaption>
</figure>
</div>
</div>
</div>
</section>
<section id="requisitosindicadores-de-qualidade-para-a-regressão-linear" class="level2" data-number="2.3">
<h2 data-number="2.3" class="anchored" data-anchor-id="requisitosindicadores-de-qualidade-para-a-regressão-linear"><span class="header-section-number">2.3</span> Requisitos/indicadores de qualidade para a regressão linear</h2>
<p>Como um professor disse uma vez:</p>
<blockquote class="blockquote">
<p>O grande perigo é a pessoa apenas saber fazer uma regressão.</p>
</blockquote>
<p>Essa frase é uma crítica às pessoas que apenas sabem montar um modelo e sair interpretando. Uma interpretação útil surge de uma regressão bem feita, e, para isso, é necessário conhecer a qualidade do modelo gerado. Abaixo estão os principais critérios para avaliar como seu modelo se comporta.</p>
<section id="as-observações-devem-ser-independentes" class="level3" data-number="2.3.1">
<h3 data-number="2.3.1" class="anchored" data-anchor-id="as-observações-devem-ser-independentes"><span class="header-section-number">2.3.1</span> As observações devem ser independentes</h3>
<p>Esse requisito diz que o valor de uma observação não pode ter influência no valor de outra observação.</p>
</section>
<section id="as-variáveis-preditivas-não-devem-possuir-alta-correlação" class="level3" data-number="2.3.2">
<h3 data-number="2.3.2" class="anchored" data-anchor-id="as-variáveis-preditivas-não-devem-possuir-alta-correlação"><span class="header-section-number">2.3.2</span> As variáveis preditivas não devem possuir alta correlação</h3>
<p>Também chamada de multicolinearidade, a alta correlação entre as variáveis independentes é um aspecto importante a ser considerado. Variáveis com alta correlação podem causar diversos problemas, como distorção dos resultados e interpretações espúrias.</p>
</section>
<section id="homocedasticidade-e-normalidade-dos-resíduos" class="level3" data-number="2.3.3">
<h3 data-number="2.3.3" class="anchored" data-anchor-id="homocedasticidade-e-normalidade-dos-resíduos"><span class="header-section-number">2.3.3</span> Homocedasticidade e normalidade dos resíduos</h3>
<p>A homocedasticidade é semelhante à homogeneidade de variâncias testada na ANOVA. No entanto, a homocedasticidade diz respeito à variância dos erros do modelo (<img src="https://latex.codecogs.com/png.latex?%5Cepsilon">), que deve ser constante em toda a escala ou nos níveis da variável <img src="https://latex.codecogs.com/png.latex?x">.</p>
<p>Já a normalidade diz respeito aos erros do modelo, que devem ser aproximadamente normais.</p>
</section>
</section>
</section>
<section id="exemplo-de-regressão" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> Exemplo de regressão</h1>
<p>Agora, vamos fazer um exemplo de regressão com variáveis contínuas e discretas no mesmo modelo. Depois vamos interpretar cada variável e verificar a qualidade do modelo.</p>
<p>Para o exemplo vamos considerar 2 variáveis dependentes que são 5 doses de algum fertilizante e outra como 3 cultivares de qualquer planta. Já a variável dependete será a produtividade dessa planta (Tabela&nbsp;2).</p>
<p>Nossa pergunta será: “<strong>As variáveis dose e cultivar são preditores da produtividade da cultura?</strong>”.</p>
<div class="cell">
<div id="tbl-media" class="cell quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-media-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Tabela&nbsp;2: Banco de dados inventado para a análise
</figcaption>
<div aria-describedby="tbl-media-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item" id="htmlwidget-d96970b9501c191ad406" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-d96970b9501c191ad406">{"x":{"filter":"none","vertical":false,"extensions":["Buttons"],"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","135","136","137","138","139","140","141","142","143","144","145","146","147","148","149","150"],["Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar1","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar2","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3","Cultivar3"],[0,0,0,0,0,0,0,0,0,0,50,50,50,50,50,50,50,50,50,50,100,100,100,100,100,100,100,100,100,100,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200,0,0,0,0,0,0,0,0,0,0,50,50,50,50,50,50,50,50,50,50,100,100,100,100,100,100,100,100,100,100,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200,0,0,0,0,0,0,0,0,0,0,50,50,50,50,50,50,50,50,50,50,100,100,100,100,100,100,100,100,100,100,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200],[47.19762176723894,48.8491125525836,57.79354157074562,50.35254195712288,50.64643867580473,58.57532493441641,52.30458102994601,43.67469382696733,46.56573574053237,47.77169014950021,61.12040898719731,56.79906913528682,57.00385725297026,55.5534135797256,52.22079432622962,63.93456568401539,57.4892523911462,45.16691421685181,58.50677950781843,52.63604296136033,54.66088147006577,58.91012542670853,54.8699777584638,56.3555438535443,56.87480366075371,51.56653344628793,64.18893522247262,60.76686558918258,54.30931531494026,66.26907460534963,67.13232110738407,63.52464258503864,69.47562830522511,69.39066743766521,69.10790540818743,68.44320127050045,67.76958826768795,64.69044144711638,63.47018668130042,63.09764499493809,66.52646510539743,68.96041360990201,63.67301824215868,80.84477982669256,76.03980999152495,64.38445708398325,67.98557582350462,67.66672323188391,73.89982559168159,69.58315466764085,46.26659256997377,44.85726622325649,44.78564771354342,51.84301142007229,43.87114507170367,52.5823530221477,37.25623597884889,47.92306874818035,45.61927121922307,46.07970784371987,51.89819741379941,47.48838273445349,48.3339630816529,44.90712308446456,44.64104386762211,51.51764320702129,52.24104889314713,50.26502113365252,54.61133733939869,60.25042342813572,52.54484416971732,43.45415562179593,60.02869262231128,51.45399618708804,51.55995691766321,60.1278568484835,53.57613496474495,48.89641143872732,55.90651739874575,54.30554318780478,60.02882092949943,61.92640200563165,58.14669984103795,63.22188274259416,58.89756719090624,61.65890981957848,65.48419506574673,62.17590745416901,58.37034207234387,65.74403809225547,69.9675192798106,67.74198479754035,66.1936586755572,61.86046961980314,71.80326224265004,61.99870206426436,75.93666496508288,72.66305313092595,63.82149820449762,59.8678954984661,36.44796718150349,41.28441854578265,38.76654060768813,38.26228700301134,35.24190716367492,39.7748613759554,36.07547765271462,31.66029031705932,38.09886739856119,44.59498304530383,42.12326518695804,48.03982161112517,36.91058645855418,44.7221901723773,47.59703601971731,46.50576681083357,45.52838097074471,41.79646995847312,40.75147826983209,39.87935604697543,50.58823298550063,45.26262692907599,47.54721278149666,48.71953903900877,59.21931002616104,46.74025049152271,51.17693286142428,50.38980424781855,45.19071682934936,49.64345956938201,62.22275429211675,57.25752026539607,55.2061646099647,52.88751583830187,44.73376389229742,60.65668606707088,47.69679964537589,58.69973755438667,64.54551784608742,47.780534195141,63.50892167687356,58.68901255298766,52.13927920427256,52.42666173109124,51.99231913212704,57.34546738914848,52.6912220750205,63.43958386487914,70.50054470262836,53.56484761982411]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>Cultivar<\/th>\n      <th>Dose<\/th>\n      <th>Produtividade<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"dom":"Bfrtip","buttons":[{"extend":"copy","title":"tabela_inventada"},{"extend":"csv","title":"tabela_inventada"},{"extend":"excel","title":"tabela_inventada"}],"columnDefs":[{"className":"dt-right","targets":[2,3]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"Cultivar","targets":1},{"name":"Dose","targets":2},{"name":"Produtividade","targets":3}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</figure>
</div>
</div>
<section id="especificando-o-modelo" class="level2" data-number="3.1">
<h2 data-number="3.1" class="anchored" data-anchor-id="especificando-o-modelo"><span class="header-section-number">3.1</span> Especificando o modelo</h2>
<p>Nosso modelo teórico e sem interação pode ser representado como:</p>
<p><img src="https://latex.codecogs.com/png.latex?y=%20%5Cbeta_0%20+%20%5Cbeta_1*dose%20+%20%5Cbeta_2*cultivar%20+%20%5Cepsilon"></p>
</section>
<section id="resultado" class="level2" data-number="3.2">
<h2 data-number="3.2" class="anchored" data-anchor-id="resultado"><span class="header-section-number">3.2</span> Resultado</h2>
<p>A Tabela&nbsp;3 mostra os resultados da regressão. Na tabela, a primeira coluna representa o intercepto ou a variável <img src="https://latex.codecogs.com/png.latex?x">. A coluna “Beta” apresenta os coeficientes ajustados, seguida pelo intervalo de confiança para o coeficiente e, por fim, o valor de <em>p</em>.</p>
<div class="cell">
<div id="tbl-regressao" class="cell quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-regressao-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Tabela&nbsp;3: Resultado da regressão linear
</figcaption>
<div aria-describedby="tbl-regressao-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<div id="zjqzqzuguz" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#zjqzqzuguz table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#zjqzqzuguz thead, #zjqzqzuguz tbody, #zjqzqzuguz tfoot, #zjqzqzuguz tr, #zjqzqzuguz td, #zjqzqzuguz th {
  border-style: none;
}

#zjqzqzuguz p {
  margin: 0;
  padding: 0;
}

#zjqzqzuguz .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#zjqzqzuguz .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#zjqzqzuguz .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#zjqzqzuguz .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#zjqzqzuguz .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#zjqzqzuguz .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#zjqzqzuguz .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#zjqzqzuguz .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#zjqzqzuguz .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#zjqzqzuguz .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#zjqzqzuguz .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#zjqzqzuguz .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#zjqzqzuguz .gt_spanner_row {
  border-bottom-style: hidden;
}

#zjqzqzuguz .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#zjqzqzuguz .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#zjqzqzuguz .gt_from_md > :first-child {
  margin-top: 0;
}

#zjqzqzuguz .gt_from_md > :last-child {
  margin-bottom: 0;
}

#zjqzqzuguz .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#zjqzqzuguz .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#zjqzqzuguz .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#zjqzqzuguz .gt_row_group_first td {
  border-top-width: 2px;
}

#zjqzqzuguz .gt_row_group_first th {
  border-top-width: 2px;
}

#zjqzqzuguz .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#zjqzqzuguz .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#zjqzqzuguz .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#zjqzqzuguz .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#zjqzqzuguz .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#zjqzqzuguz .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#zjqzqzuguz .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#zjqzqzuguz .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#zjqzqzuguz .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#zjqzqzuguz .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#zjqzqzuguz .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#zjqzqzuguz .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#zjqzqzuguz .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#zjqzqzuguz .gt_left {
  text-align: left;
}

#zjqzqzuguz .gt_center {
  text-align: center;
}

#zjqzqzuguz .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#zjqzqzuguz .gt_font_normal {
  font-weight: normal;
}

#zjqzqzuguz .gt_font_bold {
  font-weight: bold;
}

#zjqzqzuguz .gt_font_italic {
  font-style: italic;
}

#zjqzqzuguz .gt_super {
  font-size: 65%;
}

#zjqzqzuguz .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#zjqzqzuguz .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#zjqzqzuguz .gt_indent_1 {
  text-indent: 5px;
}

#zjqzqzuguz .gt_indent_2 {
  text-indent: 10px;
}

#zjqzqzuguz .gt_indent_3 {
  text-indent: 15px;
}

#zjqzqzuguz .gt_indent_4 {
  text-indent: 20px;
}

#zjqzqzuguz .gt_indent_5 {
  text-indent: 25px;
}

#zjqzqzuguz .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#zjqzqzuguz div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>

<table class="gt_table cell caption-top table table-sm table-striped small" data-quarto-bootstrap="false">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="gt_col_headings header">
<th id="label" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col"><strong>Characteristic</strong></th>
<th id="estimate" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>Beta</strong></th>
<th id="conf.low" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>95% CI</strong></th>
<th id="p.value" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>p-value</strong></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers="label">(Intercept)</td>
<td class="gt_row gt_center" headers="estimate">49.9</td>
<td class="gt_row gt_center" headers="conf.low">48.2, 51.6</td>
<td class="gt_row gt_center" headers="p.value">&lt;0.001</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">Cultivar</td>
<td class="gt_row gt_center" headers="estimate"><br>
</td>
<td class="gt_row gt_center" headers="conf.low"><br>
</td>
<td class="gt_row gt_center" headers="p.value"><br>
</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="label">&nbsp;&nbsp;&nbsp;&nbsp;Cultivar1</td>
<td class="gt_row gt_center" headers="estimate">—</td>
<td class="gt_row gt_center" headers="conf.low">—</td>
<td class="gt_row gt_center" headers="p.value"><br>
</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">&nbsp;&nbsp;&nbsp;&nbsp;Cultivar2</td>
<td class="gt_row gt_center" headers="estimate">-4.44</td>
<td class="gt_row gt_center" headers="conf.low">-6.30, -2.58</td>
<td class="gt_row gt_center" headers="p.value">&lt;0.001</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="label">&nbsp;&nbsp;&nbsp;&nbsp;Cultivar3</td>
<td class="gt_row gt_center" headers="estimate">-11.4</td>
<td class="gt_row gt_center" headers="conf.low">-13.3, -9.58</td>
<td class="gt_row gt_center" headers="p.value">&lt;0.001</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">Dose</td>
<td class="gt_row gt_center" headers="estimate">0.103</td>
<td class="gt_row gt_center" headers="conf.low">0.092, 0.113</td>
<td class="gt_row gt_center" headers="p.value">&lt;0.001</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="label" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3">No. Obs.</td>
<td class="gt_row gt_center" headers="estimate" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3">150</td>
<td class="gt_row gt_center" headers="conf.low" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3"><br>
</td>
<td class="gt_row gt_center" headers="p.value" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3"><br>
</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">R²</td>
<td class="gt_row gt_center" headers="estimate">0.775</td>
<td class="gt_row gt_center" headers="conf.low"><br>
</td>
<td class="gt_row gt_center" headers="p.value"><br>
</td>
</tr>
</tbody><tfoot>
<tr class="gt_sourcenotes odd">
<td colspan="4" class="gt_sourcenote">Abbreviation: CI = Confidence Interval</td>
</tr>
</tfoot>

</table>

</div>
</div>
</div>
</figure>
</div>
</div>
</section>
<section id="sec-interpretacao" class="level2" data-number="3.3">
<h2 data-number="3.3" class="anchored" data-anchor-id="sec-interpretacao"><span class="header-section-number">3.3</span> Interpretação</h2>
<p>O modelo criado (Tabela&nbsp;4) tem um <img src="https://latex.codecogs.com/png.latex?R%5E2"> de <img src="https://latex.codecogs.com/png.latex?0,77">, o que é considerado um valor “bom”. Todas as variáveis <img src="https://latex.codecogs.com/png.latex?x"> foram significativas (<img src="https://latex.codecogs.com/png.latex?p%3C0,05">). A interpretação de cada variável é:</p>
<p><strong>Cultivar:</strong> A Cultivar2 tem uma produtividade em média de <strong>4,44</strong> unidades a <strong>menos</strong> que a Cultivar1. Já a Cultivar3 tem produtividade média de <strong>11,4</strong> unidades a <strong>menos</strong> que a Cultivar1. Alterando a referência para a Cultivar2, observa-se que a Cultivar3 tem produtividade média de <strong>7</strong> unidades a <strong>menos</strong> que a Cultivar2</p>
<p><strong>Dose:</strong> Com relação a dose, a cada aumento de uma unidade temos um <strong>aumento</strong> na produtividade de <strong>0,103</strong> unidades.</p>
<div class="cell">
<div id="tbl-regressaocultivares" class="cell quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-regressaocultivares-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Tabela&nbsp;4: Resultado da regressão linear entre Dose e Cultivar para prever produtividade. “Refe Cultivar1” são os resultados utilizando a categória “Cultivar1” como referência, já “Refe Cultivar2” é utilizada a “Cultivar2”
</figcaption>
<div aria-describedby="tbl-regressaocultivares-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<div id="wflsxwdxcn" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#wflsxwdxcn table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#wflsxwdxcn thead, #wflsxwdxcn tbody, #wflsxwdxcn tfoot, #wflsxwdxcn tr, #wflsxwdxcn td, #wflsxwdxcn th {
  border-style: none;
}

#wflsxwdxcn p {
  margin: 0;
  padding: 0;
}

#wflsxwdxcn .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#wflsxwdxcn .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#wflsxwdxcn .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#wflsxwdxcn .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#wflsxwdxcn .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#wflsxwdxcn .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#wflsxwdxcn .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#wflsxwdxcn .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#wflsxwdxcn .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#wflsxwdxcn .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#wflsxwdxcn .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#wflsxwdxcn .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#wflsxwdxcn .gt_spanner_row {
  border-bottom-style: hidden;
}

#wflsxwdxcn .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#wflsxwdxcn .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#wflsxwdxcn .gt_from_md > :first-child {
  margin-top: 0;
}

#wflsxwdxcn .gt_from_md > :last-child {
  margin-bottom: 0;
}

#wflsxwdxcn .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#wflsxwdxcn .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#wflsxwdxcn .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#wflsxwdxcn .gt_row_group_first td {
  border-top-width: 2px;
}

#wflsxwdxcn .gt_row_group_first th {
  border-top-width: 2px;
}

#wflsxwdxcn .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#wflsxwdxcn .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#wflsxwdxcn .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#wflsxwdxcn .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#wflsxwdxcn .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#wflsxwdxcn .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#wflsxwdxcn .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#wflsxwdxcn .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#wflsxwdxcn .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#wflsxwdxcn .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#wflsxwdxcn .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#wflsxwdxcn .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#wflsxwdxcn .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#wflsxwdxcn .gt_left {
  text-align: left;
}

#wflsxwdxcn .gt_center {
  text-align: center;
}

#wflsxwdxcn .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#wflsxwdxcn .gt_font_normal {
  font-weight: normal;
}

#wflsxwdxcn .gt_font_bold {
  font-weight: bold;
}

#wflsxwdxcn .gt_font_italic {
  font-style: italic;
}

#wflsxwdxcn .gt_super {
  font-size: 65%;
}

#wflsxwdxcn .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#wflsxwdxcn .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#wflsxwdxcn .gt_indent_1 {
  text-indent: 5px;
}

#wflsxwdxcn .gt_indent_2 {
  text-indent: 10px;
}

#wflsxwdxcn .gt_indent_3 {
  text-indent: 15px;
}

#wflsxwdxcn .gt_indent_4 {
  text-indent: 20px;
}

#wflsxwdxcn .gt_indent_5 {
  text-indent: 25px;
}

#wflsxwdxcn .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#wflsxwdxcn div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>

<table class="gt_table cell caption-top table table-sm table-striped small" data-quarto-bootstrap="false">
<colgroup>
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
</colgroup>
<thead>
<tr class="gt_col_headings gt_spanner_row header">
<th rowspan="2" id="label" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col"><strong>Characteristic</strong></th>
<th colspan="3" id="level 1; estimate_1" class="gt_center gt_columns_top_border gt_column_spanner_outer" data-quarto-table-cell-role="th" scope="colgroup"><div class="gt_column_spanner">
<strong>Refe Cultivar1</strong>
</div></th>
<th colspan="3" id="level 1; estimate_2" class="gt_center gt_columns_top_border gt_column_spanner_outer" data-quarto-table-cell-role="th" scope="colgroup"><div class="gt_column_spanner">
<strong>Refe Cultivar2</strong>
</div></th>
</tr>
<tr class="gt_col_headings even">
<th id="estimate_1" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>Beta</strong></th>
<th id="conf.low_1" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>95% CI</strong></th>
<th id="p.value_1" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>p-value</strong></th>
<th id="estimate_2" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>Beta</strong></th>
<th id="conf.low_2" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>95% CI</strong></th>
<th id="p.value_2" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col"><strong>p-value</strong></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers="label">(Intercept)</td>
<td class="gt_row gt_center" headers="estimate_1">49.9</td>
<td class="gt_row gt_center" headers="conf.low_1">48.2, 51.6</td>
<td class="gt_row gt_center" headers="p.value_1">&lt;0.001</td>
<td class="gt_row gt_center" headers="estimate_2">45.5</td>
<td class="gt_row gt_center" headers="conf.low_2">43.8, 47.2</td>
<td class="gt_row gt_center" headers="p.value_2">&lt;0.001</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">Cultivar</td>
<td class="gt_row gt_center" headers="estimate_1"><br>
</td>
<td class="gt_row gt_center" headers="conf.low_1"><br>
</td>
<td class="gt_row gt_center" headers="p.value_1"><br>
</td>
<td class="gt_row gt_center" headers="estimate_2"><br>
</td>
<td class="gt_row gt_center" headers="conf.low_2"><br>
</td>
<td class="gt_row gt_center" headers="p.value_2"><br>
</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="label">&nbsp;&nbsp;&nbsp;&nbsp;Cultivar1</td>
<td class="gt_row gt_center" headers="estimate_1">—</td>
<td class="gt_row gt_center" headers="conf.low_1">—</td>
<td class="gt_row gt_center" headers="p.value_1"><br>
</td>
<td class="gt_row gt_center" headers="estimate_2">4.44</td>
<td class="gt_row gt_center" headers="conf.low_2">2.58, 6.30</td>
<td class="gt_row gt_center" headers="p.value_2">&lt;0.001</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">&nbsp;&nbsp;&nbsp;&nbsp;Cultivar2</td>
<td class="gt_row gt_center" headers="estimate_1">-4.44</td>
<td class="gt_row gt_center" headers="conf.low_1">-6.30, -2.58</td>
<td class="gt_row gt_center" headers="p.value_1">&lt;0.001</td>
<td class="gt_row gt_center" headers="estimate_2">—</td>
<td class="gt_row gt_center" headers="conf.low_2">—</td>
<td class="gt_row gt_center" headers="p.value_2"><br>
</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="label">&nbsp;&nbsp;&nbsp;&nbsp;Cultivar3</td>
<td class="gt_row gt_center" headers="estimate_1">-11.4</td>
<td class="gt_row gt_center" headers="conf.low_1">-13.3, -9.58</td>
<td class="gt_row gt_center" headers="p.value_1">&lt;0.001</td>
<td class="gt_row gt_center" headers="estimate_2">-7.00</td>
<td class="gt_row gt_center" headers="conf.low_2">-8.87, -5.14</td>
<td class="gt_row gt_center" headers="p.value_2">&lt;0.001</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">Dose</td>
<td class="gt_row gt_center" headers="estimate_1">0.103</td>
<td class="gt_row gt_center" headers="conf.low_1">0.092, 0.113</td>
<td class="gt_row gt_center" headers="p.value_1">&lt;0.001</td>
<td class="gt_row gt_center" headers="estimate_2">0.103</td>
<td class="gt_row gt_center" headers="conf.low_2">0.092, 0.113</td>
<td class="gt_row gt_center" headers="p.value_2">&lt;0.001</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="label" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3">No. Obs.</td>
<td class="gt_row gt_center" headers="estimate_1" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3">150</td>
<td class="gt_row gt_center" headers="conf.low_1" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3"><br>
</td>
<td class="gt_row gt_center" headers="p.value_1" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3"><br>
</td>
<td class="gt_row gt_center" headers="estimate_2" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3"><br>
</td>
<td class="gt_row gt_center" headers="conf.low_2" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3"><br>
</td>
<td class="gt_row gt_center" headers="p.value_2" style="border-top-width: 2px; border-top-style: solid; border-top-color: #D3D3D3"><br>
</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers="label">R²</td>
<td class="gt_row gt_center" headers="estimate_1">0.775</td>
<td class="gt_row gt_center" headers="conf.low_1"><br>
</td>
<td class="gt_row gt_center" headers="p.value_1"><br>
</td>
<td class="gt_row gt_center" headers="estimate_2"><br>
</td>
<td class="gt_row gt_center" headers="conf.low_2"><br>
</td>
<td class="gt_row gt_center" headers="p.value_2"><br>
</td>
</tr>
</tbody><tfoot>
<tr class="gt_sourcenotes odd">
<td colspan="7" class="gt_sourcenote">Abbreviation: CI = Confidence Interval</td>
</tr>
</tfoot>

</table>

</div>
</div>
</div>
</figure>
</div>
</div>
</section>
<section id="sec-qualidade" class="level2" data-number="3.4">
<h2 data-number="3.4" class="anchored" data-anchor-id="sec-qualidade"><span class="header-section-number">3.4</span> Indicadores de qualidade</h2>
<section id="outliers" class="level3" data-number="3.4.1">
<h3 data-number="3.4.1" class="anchored" data-anchor-id="outliers"><span class="header-section-number">3.4.1</span> Outliers</h3>
<p>Na regressão linear, uma das maneiras de verificar se há dados influentes para o modelo é por meio da distância de Cook. Existem diferentes interpretações em relação aos valores de corte para considerar um valor influente. Aqui, utilizo o valor de <img src="https://latex.codecogs.com/png.latex?1"> como ponto de corte. Há discussões sobre o uso de valores limite para diagnósticos, mas, de qualquer forma, utilizar o limite de <img src="https://latex.codecogs.com/png.latex?1"> já é melhor que não fazer uma avaliação de outliers.</p>
<p>Podemos observar na Figura&nbsp;4 que nenhum ponto se aproxima do valor de <img src="https://latex.codecogs.com/png.latex?1">, portanto, aparentemente, não temos pontos discrepantes que possam prejudicar o modelo.</p>
<div class="cell">
<div class="cell-output-display">
<div id="fig-cook" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-cook-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/index_files/figure-html/fig-cook-1.png" class="img-fluid figure-img" width="672">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-cook-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;4: Distância de cook para o modelo de regressão
</figcaption>
</figure>
</div>
</div>
</div>
</section>
<section id="normalidade-dos-resíduos-e-homocedasticidade" class="level3" data-number="3.4.2">
<h3 data-number="3.4.2" class="anchored" data-anchor-id="normalidade-dos-resíduos-e-homocedasticidade"><span class="header-section-number">3.4.2</span> Normalidade dos resíduos e homocedasticidade</h3>
<p>A Figura&nbsp;5 mostra o QQ-plot dos resíduos. O ideal é que os pontos estejam dispostos perfeitamente em cima da reta, mas isso é praticamente impossível nas análises do dia a dia. Portanto, quanto mais próximos da linha, melhor. Não temos um ponto de corte ou métrica de qualidade específicos para o QQ-plot. Buscamos o melhor ajuste possível, dados os dados que temos.</p>
<p>Verificamos que há alguns desvios em relação à linha, mas, no geral, o resultado é satisfatório. Com isso, podemos concluir que os resíduos são aproximadamente normais. Além disso, tudo indica que não temos problemas com a homocedasticidade.</p>
<div class="cell">
<div class="cell-output-display">
<div id="fig-normalidade" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-normalidade-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/index_files/figure-html/fig-normalidade-1.png" class="img-fluid figure-img" width="672">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-normalidade-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;5: QQ-plot dos resíduos do modelo
</figcaption>
</figure>
</div>
</div>
</div>
</section>
<section id="multicolinearidade" class="level3" data-number="3.4.3">
<h3 data-number="3.4.3" class="anchored" data-anchor-id="multicolinearidade"><span class="header-section-number">3.4.3</span> Multicolinearidade</h3>
<p>A tolerância entre as variáveis foi de <img src="https://latex.codecogs.com/png.latex?1"> (Tabela&nbsp;5) o que significa uma boa tolerância. Em geral, acima de <img src="https://latex.codecogs.com/png.latex?0,80"> já temos variáveis que se toleram no modelo.</p>
<div class="cell">
<div id="tbl-vif" class="cell quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-vif-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Tabela&nbsp;5: Tolerância entre as variáveis do modelo
</figcaption>
<div aria-describedby="tbl-vif-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<table class="cell caption-top table table-sm table-striped small">
<thead>
<tr class="header">
<th style="text-align: left;">Term</th>
<th style="text-align: right;">VIF</th>
<th style="text-align: right;">Tolerance</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Cultivar</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">1</td>
</tr>
<tr class="even">
<td style="text-align: left;">Dose</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">1</td>
</tr>
</tbody>
</table>
</div>
</div>
</figure>
</div>
</div>
<p>O teste de Durbin-Watson é utilizado para verificar a autocorrelação entre os resíduos da regressão. O valor ideal desse teste é <img src="https://latex.codecogs.com/png.latex?2">, o que indica a ausência de autocorrelação. Se o valor for maior ou menor que <img src="https://latex.codecogs.com/png.latex?2">, há indícios de autocorrelação positiva ou negativa, respectivamente.</p>
<p>A análise do Durbin-Watson (Tabela&nbsp;6) mostra um valor de <img src="https://latex.codecogs.com/png.latex?2,08">, ou seja, é aproximadamente <img src="https://latex.codecogs.com/png.latex?2"> e indica que não temos autocorrelação.</p>
<div class="cell">
<div id="tbl-durbin" class="cell quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-durbin-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Tabela&nbsp;6: QQ-plot dos resíduos do modelo
</figcaption>
<div aria-describedby="tbl-durbin-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output-display">
<table class="cell caption-top table table-sm table-striped small">
<thead>
<tr class="header">
<th style="text-align: right;">z</th>
<th style="text-align: right;">p</th>
<th style="text-align: left;">Method</th>
<th style="text-align: left;">Alternative</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: right;">2.08806</td>
<td style="text-align: right;">0.61766</td>
<td style="text-align: left;">Durbin-Watson test</td>
<td style="text-align: left;">true autocorrelation is greater than 0</td>
</tr>
</tbody>
</table>
</div>
</div>
</figure>
</div>
</div>
</section>
</section>
<section id="representação-gráfica-do-modelo" class="level2" data-number="3.5">
<h2 data-number="3.5" class="anchored" data-anchor-id="representação-gráfica-do-modelo"><span class="header-section-number">3.5</span> Representação gráfica do modelo</h2>
<p>Na Seção&nbsp;3.3 vimos quais foram os efeitos significativos do modelo, já na Seção&nbsp;3.4 observamos que o modelo está adequado e explica bem os dados. Agora, criamos uma visualização gráfica para apresentar melhor os resultados. Poderia ter sido feito um gráfico com as médias dos grupos de cultivares, mostrando o intervalo de confiança e uma regressão com as doses, mas preferi representar dessa forma.</p>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/index_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</section>
</section>
<section id="regressão-vs-anova" class="level1" data-number="4">
<h1 data-number="4"><span class="header-section-number">4</span> Regressão vs ANOVA</h1>
<p>Parece que essa frase gera um conflito dentro da agronomia. Aparenta que usamos as técnicas para coisas totalmente diferentes, mas no final das contas uma ANOVA é um caso particular da regressão linear. Todos os resultados obtidos em um teste de ANOVA serão encontrado em um modelo de regressão linear.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center collapsed" data-bs-toggle="collapse" data-bs-target=".callout-2-contents" aria-controls="callout-2" aria-expanded="false" aria-label="Toggle callout">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Nota</span>Resultado da ANOVA
</div>
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
</div>
<div id="callout-2" class="callout-2-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<p>Realizando uma ANOVA para comparação</p>
<p>Tabela anova</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>             Df Sum Sq Mean Sq F value Pr(&gt;F)    
Cultivar      2   3327    1664   74.77 &lt;2e-16 ***
Dose          1   7889    7889  354.55 &lt;2e-16 ***
Residuals   146   3249      22                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>Normalidade</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 3
  variable      statistic     p
  &lt;chr&gt;             &lt;dbl&gt; &lt;dbl&gt;
1 Produtividade     0.991 0.482</code></pre>
</div>
</div>
<p>Homogeneidade</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 4
    df1   df2 statistic     p
  &lt;int&gt; &lt;int&gt;     &lt;dbl&gt; &lt;dbl&gt;
1     2   147    0.0904 0.914</code></pre>
</div>
</div>
<p>Comparações por tukey</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code> Cultivar  emmean    SE  df lower.CL upper.CL .group
 Cultivar3   48.7 0.667 146     47.4     50.0  a    
 Cultivar2   55.7 0.667 146     54.4     57.1   b   
 Cultivar1   60.2 0.667 146     58.9     61.5    c  

Confidence level used: 0.95 
P value adjustment: tukey method for comparing a family of 3 estimates 
significance level used: alpha = 0.05 
NOTE: If two or more means share the same grouping symbol,
      then we cannot show them to be different.
      But we also did not show them to be the same. </code></pre>
</div>
</div>
<p>Regressão das doses</p>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Produtividade ~ Dose, data = dados)

Residuals:
     Min       1Q   Median       3Q      Max 
-15.2724  -4.7458   0.1992   4.6481  15.7107 

Coefficients:
             Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 44.622242   0.942674   47.34   &lt;2e-16 ***
Dose         0.102559   0.007697   13.32   &lt;2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 6.666 on 148 degrees of freedom
Multiple R-squared:  0.5454,    Adjusted R-squared:  0.5423 
F-statistic: 177.5 on 1 and 148 DF,  p-value: &lt; 2.2e-16</code></pre>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="referências" class="level1" data-number="5">
<h1 data-number="5"><span class="header-section-number">5</span> Referências</h1>
<p><a href="&quot;https://galton.org/essays/1880-1889/galton-1886-jaigi-regression-stature.pdf&quot;">Galton, F.S. Regression Towards Mediocrity in Hereditary Stature. The Journal of the Anthropological Institute of Great Britain and Ireland, 15, 246.</a></p>
<p><a href="&quot;https://web.williams.edu/Mathematics/sjmiller/public_html/105Sp10/handouts/MethodLeastSquares.pdf&quot;">Miller, S. J. (2006). The method of least squares. Mathematics Department Brown University, 8(1), 5-11.</a></p>
<p><a href="'">Field, A., Miles, J., &amp; Field, Z. (2012). Discovering statistics using R. SAGE Publications.</a></p>
<p><a href="&quot;https://doi.org/10.1038/s41433-022-01949-z&quot;">Bzovsky, S., Phillips, M.R., Guymer, R.H. et al.&nbsp;The clinician’s guide to interpreting a regression analysis. Eye 36, 1715–1717 (2022).</a></p>
<p><a href="&quot;https://wires.onlinelibrary.wiley.com/doi/abs/10.1002/wics.1198?casa_token=dBGX5Xe2CBgAAAAA%3A_H6oh6Ib_EjYxUhAAGlOsGOYDLVG8-Mr3_wBLFYWYBtB3Zbr-pltrMPkBKoDTn4GfL_ekrYJixXDag&quot;">Su, X., Yan, X., &amp; Tsai, C.-L. (2012). Linear regression. Wiley Interdisciplinary Reviews: Computational Statistics, 4(3), 275–294.</a></p>
<p><a href="&quot;https://doi.org/10.1007/978-981-97-3385-9_7">Okoye, K., Hosseini, S. (2024). Regression Analysis in R: Linear Regression and Logistic Regression. In: R Programming. Springer, Singapore.</a></p>


</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> De volta ao topo</a><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citação</h2><div><div class="quarto-appendix-secondary-label">BibTeX</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{frosi2024,
  author = {Frosi, Gustavo},
  title = {Do caos ao conhecimento: \textless br\textgreater{} use \$y =
    \textbackslash beta\_\{0\} + \textbackslash beta\_\{1\}x +
    \textbackslash epsilon\$ para explicar seus experimentos},
  date = {2024-08-22},
  url = {https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/},
  doi = {10.59350/ettr2-9w559},
  langid = {pt}
}
</code></pre><div class="quarto-appendix-secondary-label">Por favor, cite este trabalho como:</div><div id="ref-frosi2024" class="csl-entry quarto-appendix-citeas">
Frosi, Gustavo. 2024. <span>“Do caos ao conhecimento: &lt;br&gt; use $y
= \beta_{0} + \beta_{1}x + \epsilon$ para explicar seus
experimentos.”</span> August 22. <a href="https://doi.org/10.59350/ettr2-9w559">https://doi.org/10.59350/ettr2-9w559</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Regressão Linear</category>
  <category>Estatística</category>
  <guid>https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/</guid>
  <pubDate>Thu, 22 Aug 2024 03:00:00 GMT</pubDate>
  <media:content url="https://gustavofrosi.com.br/recap/2024-08-21 regressão linear/ima_fundo.jpeg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>Quantos artigos eu preciso ter no currículo até o fim do doutorado em Ciência do Solo?</title>
  <dc:creator>Gustavo Frosi</dc:creator>
  <link>https://gustavofrosi.com.br/recap/2024-04-09 artigos doutorandos/</link>
  <description><![CDATA[ 





<section id="introdução" class="level1">
<h1>Introdução</h1>
<p>A resposta é óbvia: Não sei!</p>
<p>E não tem como saber, pois, vai depender de perguntas que vão para além do individual de cada um. Agora, não significa que não podemos fazer algumas comparações e tentar sair do escuro. Bem, é exatamente isso que eu trago nesse texto. Não são raros os dias que penso que tudo que faço (da Pós-graduação) leva milhões de anos para ficar pronto e, por consequência, me vejo divagando em uma estrada de pensamentos que não tem fim. Para acalmar minhas expectativas, eu resolvi fazer algo. Gastei parte do meu tempo para tentar encontrar parte da resposta. Assim, investiguei, mesmo que superficialmente, a pergunta: Qual o desempenho dos estudantes de doutorado que já passaram pela pós? Com a esperança de encontrar algo para verificar como está o meu andamento individual. O desempenho é difícil de mensurar e, bem, o que o desempenho realmente mede, né? Mas utilizei o que tinha em meu alcance para traçar uma linha de raciocínio. A informação mais fácil de conseguir de alunos já doutores é o número de artigos que publicaram e que estão no currículo Lattes. Com base nesses números levantei algumas hipóteses: 1. Artigos demandam tempo e o número de publicações reflete o tempo investido. 2. A quantidade de artigos pode indicar as parcerias do aluno. 3. Quanto mais artigos, mais a pessoa se dedica a temas relacionados à pós-graduação. Obviamente, há problemas com essas hipóteses e elas abordam apenas uma parte do problema, mas são as que tenho até o momento. Ainda assim, a necessidade de publicar artigos por parte dos alunos torna essa uma opção interessante a ser considerada.</p>
<section id="metodologia" class="level2">
<h2 class="anchored" data-anchor-id="metodologia">Metodologia</h2>
<p>Para minha análise, coletei dados de diversas fontes. A análise foi conduzida exclusivamente com alunos de doutorado que frequentaram o curso de Ciência do Solo entre os anos de 2013 e 2022. O período foi determinado de forma arbitrária, com base no tempo disponível para realizar o trabalho. Como sou aluno da UFRGS, utilizei os dados dos egressos do Programa de Pós-Graduação em Ciência do Solo desta universidade. No entanto, para aumentar a amostra, incluí também dados da pós-graduação em Ciência do Solo da UFSM.</p>
<p>Nos sites de cada programa de pós-graduação (Egressos da UFRGS e Egressos do PPGCS da UFSM), compilei o número e os nomes dos alunos formados em cada um dos anos especificados. Inicialmente, fiquei surpreso ao descobrir que o PPGCS da UFSM possui um levantamento sobre a atuação profissional de seus egressos. Essa é exatamente mais uma das ideias que gostaria de implementar com os alunos do PPGCS da UFRGS, já que desconheço tal informação.</p>
<p>Com os nomes em mãos, iniciei a tarefa mais trabalhosa de todo o processo: encontrar e baixar o currículo Lattes de cada um deles. Ao todo, foram baixados 86 currículos da UFRGS e 98 da UFSM.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>Os dados podem ser baixados no meu github <a href="https://github.com/FGu5tav0/artigos_doutorado_solos">link</a></p>
</div>
</div>
<p>Outra informação importante era determinar os anos em que cada pessoa cursou o doutorado em seus respectivos programas de pós-graduação. Para isso, obtive a base de dados de discentes da CAPES, que abrange o período de 2004 a 2022. Utilizei o currículo Lattes como filtro para identificar os alunos que concluíram o doutorado em cada um dos programas e os anos em que estiveram matriculados.</p>
<p>A maior dificuldade agora é definir quais artigos cada pessoa publicou durante o doutorado. Inicialmente, não há como fazer essa distinção, pois essa informação não está disponível no Lattes e não posso me dar ao luxo de investir mais tempo nessa investigação. Portanto, estabeleci um critério de corte: considerei apenas os artigos com ano de publicação igual ou anterior ao ano de conclusão do doutorado. Reconheço que, na prática, a maioria dos artigos é publicada no ano seguinte à submissão, e que os alunos tendem a publicar os artigos do doutorado mais próximo do final do curso, o que poderia resultar em anos diferentes. No entanto, essa foi a abordagem que encontrei para manter todos os dados em uma mesma “base”. É importante ressaltar que estamos partindo do zero em termos de informação. Com os resultados obtidos, realizei uma análise descritiva dos dados por meio de histogramas. Além disso, elaborei um gráfico da frequência total de artigos publicados e conduzi uma análise dos títulos dos artigos por meio de uma nuvem de palavras, levando em consideração as palavras mais frequentes encontradas nos artigos. Por fim, realizei uma análise da frequência com que termos como nitrogênio, fósforo e potássio aparecem nos títulos, como uma forma indireta de compreender a tendência ou determinar qual é considerado mais importante.</p>
</section>
<section id="resultados" class="level2">
<h2 class="anchored" data-anchor-id="resultados">Resultados</h2>
<p>Dos 184 alunos da amostra, um total de 1517 artigos foram encontrados, porém 4 dos alunos não tinham nenhum artigo em seus currículos Lattes. Isso suscita uma discussão inicial sobre a importância do Lattes e a necessidade de mantê-lo atualizado. O Lattes é um exemplo mundial de uma plataforma bem-sucedida que armazena dados de pesquisadores e alunos. Apesar de suas falhas, é inegável seu valor como um repositório de acesso público. De fato, o Lattes é a fonte de dados para várias pesquisas interessantes. O histograma (Figura 1) mostra que a distribuição de artigos publicados com ano igual ou inferior ao ano de conclusão do doutorado é assimétrica negativa ou se aproxima disso. Com um número maior de pessoas publicando números pequenos de artigos frente a números mais altos.</p>
<p><img src="https://gustavofrosi.com.br/recap/2024-04-09 artigos doutorandos/ima/hist.jpeg" class="img-fluid"> Figura 1: Histograma da distribuição do número de artigos por aluno.</p>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Aviso
</div>
</div>
<div class="callout-body-container callout-body">
<p>um modelo de massa de probabilidade será ajustado no futuro</p>
</div>
</div>
<p>A Figura 2 apresenta os dados expressos em termos de frequência (absoluta e acumulada). O número médio de artigos foi de 8; no entanto, devido à natureza assimétrica da curva, a média pode não representar adequadamente os dados. Portanto, a mediana, com um valor de 6 artigos, pode ser mais relevante. Isso revela uma descoberta significativa: o número mais frequente corresponde à própria mediana. Além disso, mais de 50% dos alunos no banco de dados publicaram entre 2 e 8 artigos. A avaliação se isso é muito ou pouco depende de vários aspectos. Outro dado interessante é que 90% dos alunos tiveram entre 0 e 18 artigos. No entanto, ao observar o gráfico, é evidente que números elevados são raros. Espero que esta breve análise auxilie meus colegas de mestrado e doutorado em Ciência do Solo a refletirem sobre sua produção acadêmica.</p>
<p><img src="https://gustavofrosi.com.br/recap/2024-04-09 artigos doutorandos/ima/freq.jpeg" class="img-fluid"> Figura 2: Frequência relativa e acumuada do número de artigos por aluno de doutorado.</p>
<section id="análise-dos-títulos" class="level3">
<h3 class="anchored" data-anchor-id="análise-dos-títulos">Análise dos títulos</h3>
<p>Com os títulos, temos a nuvem de palavras. Essa visualização mostra as palavras mais frequentes nos títulos dos mais de mil artigos avaliados. Como esperado, ‘Solo’ e ‘Brasil’ são as palavras mais comuns. Em seguida, encontramos palavras como ‘produtividade’, ‘diferentes’, ‘nitrogênio’, ‘fósforo’ e assim por diante. Acredito que uma mensagem interessante aqui seja tentar evitar palavras óbvias. Embora seja desafiador, aumentar a diversidade nos títulos é uma prática enriquecedora.</p>
<center>
<iframe src="ima/total.html" width="750" height="650">
</iframe>
</center>
</section>
<section id="análise-de-n-p-e-k-em-títulos" class="level3">
<h3 class="anchored" data-anchor-id="análise-de-n-p-e-k-em-títulos">Análise de N, P e K em títulos</h3>
<p>Bem, como estou realizando meu doutorado com potássio, achei interessante verificar a frequência com que ele é mencionado nos títulos dos artigos. Surpreendentemente, ele é pouco mencionado. A Figura 3 mostra uma visualização do número de vezes que N, P e K aparecem nos títulos, tanto em português quanto em inglês. É interessante notar a disparidade significativa entre os elementos. Não sei se isso está relacionado à importância, à dificuldade de pesquisa ou a algum outro fator que possa explicar essa diferença. Acredito que ainda não tenhamos descoberto tudo o que podemos sobre nenhum desses elementos.</p>
<p><img src="https://gustavofrosi.com.br/recap/2024-04-09 artigos doutorandos/ima/npk.jpeg" class="img-fluid"> Figura 2: Número de vezes que N, P e K foram encontrados nos títulos dos artigos.</p>
</section>
</section>
<section id="conclusão" class="level2">
<h2 class="anchored" data-anchor-id="conclusão">Conclusão</h2>
<p>Para concluir, determinar o número ideal de artigos é uma tarefa complexa, e esta análise está longe de fornecer uma resposta definitiva. No entanto, é inegável que os dados coletados oferecem informações importantes. Espero que essas descobertas incentivem meus colegas a refletirem sobre suas próprias jornadas acadêmicas. Questões como essa são fascinantes de investigar, e caso surjam dúvidas ou alguém queira contribuir, não hesite em enviar uma mensagem.</p>


</section>
</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> De volta ao topo</a> ]]></description>
  <category>R</category>
  <category>Doutorado</category>
  <category>DataViz</category>
  <category>ggplot2</category>
  <guid>https://gustavofrosi.com.br/recap/2024-04-09 artigos doutorandos/</guid>
  <pubDate>Mon, 15 Apr 2024 03:00:00 GMT</pubDate>
  <media:content url="https://gustavofrosi.com.br/recap/2024-04-09 artigos doutorandos/aritogos_ima.jpeg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>BananaBudget</title>
  <dc:creator>Gustavo Frosi</dc:creator>
  <dc:creator>Diogo Bolzan</dc:creator>
  <link>https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/</link>
  <description><![CDATA[ 





<section id="introdução" class="level1">
<h1>Introdução</h1>
<div class="columns">
<div class="column" style="width:70%;">
<p><em>Você já pensou qual seu gasto no mercado? Quais os produtos que mais compra? Qual a frequência que vai ao mercado?</em></p>
<p><em>Eu e o <a href="https://diogovieri.rbind.io/">Diogo</a> já!</em></p>
</div><div class="column" style="width:30%;">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/hex.png" class="img-fluid quarto-figure quarto-figure-center figure-img"></p>
</figure>
</div>
</div>
</div>
<p>Neste texto, vamos mostrar como manipulamos notas fiscais de mercado para responder às questões iniciais por meio da programação. Morando em Porto Alegre com mais duas pessoas (totalizando quatro), é fundamental ter um controle de gastos. Após vários meses registrando todos os gastos no mercado, surgiu a seguinte pergunta: “Será que podemos identificar quais produtos compramos com maior ou menor frequência?” <em>(coisa de doido, né?)</em>. De certa forma, já sabíamos que, ao utilizar o CPF nas compras, as notas ficam armazenadas em algum lugar, mas não tínhamos certeza de onde.</p>
<p>No Rio Grande do Sul, assim como em outros estados, existe um sistema de “recompensa” chamado Nota Fiscal Gaúcha. Ao adicionar o CPF nas notas, você concorre a prêmios e outras vantagens. Além disso, é possível acessar todas as notas fiscais, com informações como data, produtos adquiridos, preços e estabelecimentos.</p>
<p>Uma maneira de obter essas notas é por meio de <em>“web scraping”</em>. Para saber mais sobre esse processo, você pode conferir o <a href="https://gustavofrosi.com.br/recap/2024-02-05%20webscraping%20python/">Post</a>, onde descrevemos como realizá-lo.</p>
<p>Com notas na mão (ou no pc) é hora de organizar os dados!</p>
</section>
<section id="extração-de-dados-dos-pdfs" class="level1">
<h1>Extração de dados dos pdfs</h1>
<p>Criamos uma função chamada “pega_produto()”, essa função identifica padrões no texto e separa as informações em um <em>data frame</em>, onde cada linha representa um produto comprado. Ao aplicar essa função em todas as notas, obtemos uma base de dados com os seguintes campos: Data, Hora, Nome do Produto, Preço do Produto… (Figura&nbsp;1)</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Carregando os pacotes</span></span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(pdftools) <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># manipulação de pdf</span></span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse) <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># conjunto de pacotes para manipulação e visualização</span></span>
<span id="cb1-4"></span>
<span id="cb1-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Primeiro defini o diretório da pasta com as notas.</span></span>
<span id="cb1-6">pasta <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"notas/notas/"</span></span>
<span id="cb1-7"></span>
<span id="cb1-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># lista os arquivos dentro da pasta</span></span>
<span id="cb1-9">docs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list.files</span>(pasta, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">full.names =</span> T)</span>
<span id="cb1-10"></span>
<span id="cb1-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># a função 'pega_produto' será responsável por encontrar cada linha da nota com os produtos</span></span>
<span id="cb1-12">pega_produto <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(pdf) {</span>
<span id="cb1-13">  df <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span id="cb1-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pdf_text</span>(pdf) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-15">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">strsplit</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-16">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unlist</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-17">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">enframe</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">name =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">value =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"linha"</span>)</span>
<span id="cb1-18"></span>
<span id="cb1-19">  data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-20">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_detect</span>(linha, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Data de Emissão"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-21">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_extract</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}.</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}.</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{4}.</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}.</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}.</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}"</span>)</span>
<span id="cb1-22"></span>
<span id="cb1-23">  produtos <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-24">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_detect</span>(linha, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">S</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{4,}"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-25">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_detect</span>(linha, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"^</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">s{4,}</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-26">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linha =</span> linha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> stringr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_replace_all</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"[</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">s]{3,}"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">replacement =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"---"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-27">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">separate</span>(</span>
<span id="cb1-28">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> linha, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">into =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb1-29">        <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ts"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"id"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"nome"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"quant"</span>,</span>
<span id="cb1-30">        <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"unidade"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"valor_uni"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"valor_total"</span></span>
<span id="cb1-31">      ),</span>
<span id="cb1-32">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sep =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"---"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">convert =</span> F</span>
<span id="cb1-33">    ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-34">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb1-35"></span>
<span id="cb1-36">  dados_fim <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-37">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.data =</span> produtos,</span>
<span id="cb1-38">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(</span>
<span id="cb1-39">      data,</span>
<span id="cb1-40">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(produtos<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>id)</span>
<span id="cb1-41">    )</span>
<span id="cb1-42">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-43">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">separate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> data, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">into =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"data"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"hora"</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sep =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" "</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-44">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-45">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hora =</span> hora <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_extract</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">:</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">:</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">d{2}"</span>),</span>
<span id="cb1-46">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_uni =</span> valor_uni <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> stringr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_replace_all</span>(</span>
<span id="cb1-47">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"[</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">,]"</span>,</span>
<span id="cb1-48">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">replacement =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"."</span></span>
<span id="cb1-49">      ),</span>
<span id="cb1-50">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_total =</span> valor_total <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> stringr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_replace_all</span>(</span>
<span id="cb1-51">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"[</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">,]"</span>,</span>
<span id="cb1-52">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">replacement =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"."</span></span>
<span id="cb1-53">      )</span>
<span id="cb1-54">    ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-55">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">relocate</span>(data, hora) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-56">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-57">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dmy</span>(data),</span>
<span id="cb1-58">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(id),</span>
<span id="cb1-59">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_uni =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(valor_uni),</span>
<span id="cb1-60">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_total =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(valor_total)</span>
<span id="cb1-61">    )</span>
<span id="cb1-62"></span>
<span id="cb1-63">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">return</span>(dados_fim)</span>
<span id="cb1-64">}</span>
<span id="cb1-65"></span>
<span id="cb1-66"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># criando a base de dados</span></span>
<span id="cb1-67">base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>)</span>
<span id="cb1-68"></span>
<span id="cb1-69"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># para utilizar a função pega_produto() em cada nota usamos um loop for e juntamos as linhas com a função bind_rows()</span></span>
<span id="cb1-70"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> (i <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(docs)) {</span>
<span id="cb1-71">  b1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pega_produto</span>(docs[i])</span>
<span id="cb1-72">  base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> base <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_rows</span>(b1)</span>
<span id="cb1-73">}</span>
<span id="cb1-74"></span>
<span id="cb1-75"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># aqui visualizamos a base</span></span>
<span id="cb1-76">base <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glimpse</span>()</span>
<span id="cb1-77"></span>
<span id="cb1-78"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># e por fim salvamos</span></span>
<span id="cb1-79"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">save</span>(base, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">file =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"notas/base.RData"</span>)</span></code></pre></div></div>
</div>
<div id="fig-tabela" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-tabela-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/ima/data_base.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-tabela-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;1: base de dados
</figcaption>
</figure>
</div>
</section>
<section id="organização-dos-dados" class="level1">
<h1>Organização dos dados</h1>
<p>Nossa base de dados foi construída com 205 notas fiscais do período de janeiro a dezembro de 2023. Após uma visualização prévia, decidimos criar uma variável relacionada ao tipo de produto, resultando na variável “categoria” (conforme apresentado na <strong>Tabela 1</strong>). O número de categorias foi determinado subjetivamente, com a intenção de discriminar adequadamente os produtos.</p>
<div class="cell">
<div class="cell-output-display">
<table class="caption-top table table-sm table-striped small">
<thead>
<tr class="header">
<th style="text-align: left;">Categoria</th>
<th style="text-align: left;">Item</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Carboidratos</td>
<td style="text-align: left;">Pão, Massas, Arroz…</td>
</tr>
<tr class="even">
<td style="text-align: left;">Doces</td>
<td style="text-align: left;">Chocolate, Sorvete, Bolacha…</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Bebidas</td>
<td style="text-align: left;">Leite, Refrigerante, Água…</td>
</tr>
<tr class="even">
<td style="text-align: left;">Embutidos</td>
<td style="text-align: left;">Queijo, Linguiça Calabresa, Bacon…</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Carnes E Ovos</td>
<td style="text-align: left;">Ovo, Carnes Vermelhas, Peito de Frango…</td>
</tr>
<tr class="even">
<td style="text-align: left;">Higiene</td>
<td style="text-align: left;">Desodorante, Sabonete…</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Frutas</td>
<td style="text-align: left;">Banana, Maça, Uva…</td>
</tr>
<tr class="even">
<td style="text-align: left;">Verduras</td>
<td style="text-align: left;">Tomate, Pepino, Alface…</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Limpeza</td>
<td style="text-align: left;">Amaciante, Detergente…</td>
</tr>
<tr class="even">
<td style="text-align: left;">Temperos E Molhos</td>
<td style="text-align: left;">Massa de Tomate, Salsa, Orégano…</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Tivemos que tomar algumas decisões em relação aos produtos que iríamos incluir na tabela. O primeiro ponto foi determinar que produtos que tivessem apenas uma compra seriam excluídos. Nossa pergunta inicial não visa produtos específicos, mas sim um padrão de consumo geral.</p>
<p>Uma maneira que encontramos para agrupar produtos foi utilizar apenas a primeira palavra do nome do item. No entanto, observamos dois problemas: o primeiro foi a ocorrência de produtos iguais com nomes iniciais diferentes, enquanto o segundo foi a presença de produtos diferentes com nomes iniciais iguais.</p>
<p>Exemplo 1: A palavra <img src="https://latex.codecogs.com/png.latex?%5Ctextbf%7BCHOC%7D"> e <img src="https://latex.codecogs.com/png.latex?%5Ctextbf%7BCHO%7D"> representava o mesmo produto, chocolate.</p>
<p>Exemplo 2: A palavra <img src="https://latex.codecogs.com/png.latex?%5Ctextbf%7BMINI%7D"> era observada no <img src="https://latex.codecogs.com/png.latex?%5Ctextbf%7BMINI%20TOMATE%7D"> e no <img src="https://latex.codecogs.com/png.latex?%5Ctextbf%7BMINI%20PANETONE%7D">.</p>
<p>Esses casos foram tratados de forma manual e caso a caso.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># realizamos uma organização após uma visualização prêvia das categorias </span></span>
<span id="cb2-2">base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> base <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb2-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">categoria =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(cat),</span>
<span id="cb2-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hora =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">hms</span>(hora),</span>
<span id="cb2-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mes =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">month</span>(data),</span>
<span id="cb2-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">inicial =</span> ini</span>
<span id="cb2-8">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(cat, ini)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb2-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mes =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_match</span>(</span>
<span id="cb2-12">      mes,</span>
<span id="cb2-13">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"jan"</span>,</span>
<span id="cb2-14">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fev"</span>,</span>
<span id="cb2-15">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mar"</span>,</span>
<span id="cb2-16">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"abr"</span>,</span>
<span id="cb2-17">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mai"</span>,</span>
<span id="cb2-18">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"jun"</span>,</span>
<span id="cb2-19">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"jul"</span>,</span>
<span id="cb2-20">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ago"</span>,</span>
<span id="cb2-21">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"set"</span>,</span>
<span id="cb2-22">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"out"</span>,</span>
<span id="cb2-23">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"nov"</span>,</span>
<span id="cb2-24">      <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"dez"</span></span>
<span id="cb2-25">    ),</span>
<span id="cb2-26">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mes =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_to_title</span>(mes),</span>
<span id="cb2-27">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">categoria =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_to_title</span>(categoria),</span>
<span id="cb2-28">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mes =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">factor</span>(mes, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ordered =</span> T, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">levels =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb2-29">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Jan"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fev"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mar"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Abr"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mai"</span>,</span>
<span id="cb2-30">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Jun"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Jul"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Ago"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Set"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Out"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nov"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dez"</span></span>
<span id="cb2-31">    ))</span>
<span id="cb2-32">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-33">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>( <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># aqui é onde realizamos a junção mencionadas nos exemplos 1 e 2 </span></span>
<span id="cb2-34">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">inicial =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb2-35">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CHO"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BOMBOM"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CHOC"</span>,</span>
<span id="cb2-36">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SORVETE"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SORV"</span>,</span>
<span id="cb2-37">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BISCOITO"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"COOKIE"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CLUB"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BARRA"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BISC"</span>,</span>
<span id="cb2-38">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"DOCE"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ECLAIR"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BIBIS"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BALA"</span>,</span>
<span id="cb2-39">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CONFEITO"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"MIST"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BOLO"</span>,</span>
<span id="cb2-40">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"REFR"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BIPACK"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"REFRIG"</span>,</span>
<span id="cb2-41">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"VH"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"VHO"</span>,</span>
<span id="cb2-42">    inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"MINI"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"TOMATE"</span>,</span>
<span id="cb2-43">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.default =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.character</span>(inicial)</span>
<span id="cb2-44">  ))</span></code></pre></div></div>
</div>
</section>
<section id="gasto-total-por-categoria" class="level1">
<h1><strong>Gasto total por categoria</strong></h1>
<p>A primeira visualização foi focada em observar o gasto total em cada uma das categorias e o número de compras efetuadas.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># pacotes utilizados em todos os gráficos</span></span>
<span id="cb3-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb3-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(showtext)</span>
<span id="cb3-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggtext)</span></code></pre></div></div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">base <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(categoria) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarise</span>(</span>
<span id="cb4-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_total =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(valor_total),</span>
<span id="cb4-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">numero =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">n</span>()</span>
<span id="cb4-6">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_reorder</span>(categoria, valor_total), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> valor_total) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-9">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># geom_col(fill = "firebrick") +</span></span>
<span id="cb4-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"firebrick"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_richtext</span>(</span>
<span id="cb4-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mapping =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(</span>
<span id="cb4-14">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"O nº diz respeito a quantidade &lt;br&gt; de itens comprados"</span>,</span>
<span id="cb4-15">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000</span></span>
<span id="cb4-16">    ), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,</span>
<span id="cb4-17">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray70"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label.color =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>,</span>
<span id="cb4-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Black Ops One"</span>,</span>
<span id="cb4-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label.padding =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span>), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"lines"</span>),</span>
<span id="cb4-20">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-21">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb4-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb4-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Valor total [R$]"</span>,</span>
<span id="cb4-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gasto total por categoria"</span>,</span>
<span id="cb4-25">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption =</span> social_caption</span>
<span id="cb4-26">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(</span>
<span id="cb4-28">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mapping =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"nº"</span>, numero)),</span>
<span id="cb4-29">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_y =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">125</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray98"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fontface =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span></span>
<span id="cb4-30">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-31">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">23</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-32">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb4-33">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Black Ops One"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>),</span>
<span id="cb4-34">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.background =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_rect</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray90"</span>),</span>
<span id="cb4-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.caption =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_textbox_simple</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>)</span>
<span id="cb4-36">  )</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/ima/cat_total.jpeg" class="img-fluid figure-img" width="1500"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="gasto-mensal-das-principais-categorias" class="level1">
<h1><strong>Gasto mensal das principais categorias</strong></h1>
<p>O segundo gráfico mostra o gasto mês-a-mês para cada categoria. Para isso utilizamos apenas as 5 maiores categorias em total de gasto.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1">gg_bonito <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> base <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(categoria, mes) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarise</span>(</span>
<span id="cb5-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_total =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(valor_total),</span>
<span id="cb5-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">numero =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">n</span>()</span>
<span id="cb5-6">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span>categoria <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%in%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb5-8">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Temperos E Molhos"</span>,</span>
<span id="cb5-9">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Limpeza"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Verduras"</span>,</span>
<span id="cb5-10">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frutas"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Higiene"</span></span>
<span id="cb5-11">  ))</span>
<span id="cb5-12">gg_bonito2 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> gg_bonito <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(mes) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb5-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">total_mensal =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(valor_total),</span>
<span id="cb5-16">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_cat =</span> total_mensal <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> valor_total</span>
<span id="cb5-17">  )</span>
<span id="cb5-18"></span>
<span id="cb5-19"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(gg_bonito) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(</span>
<span id="cb5-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> mes,</span>
<span id="cb5-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">node =</span> categoria,</span>
<span id="cb5-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> categoria,</span>
<span id="cb5-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">value =</span> valor_total</span>
<span id="cb5-25">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-26">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_sankey_bump</span>(</span>
<span id="cb5-27">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">space =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="cb5-28">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"alluvial"</span>,</span>
<span id="cb5-29">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"transparent"</span>,</span>
<span id="cb5-30">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">smooth =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span></span>
<span id="cb5-31">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-32">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_fill_viridis_d</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">option =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">alpha =</span> .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-33">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_sankey_bump</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-34">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_x_discrete</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">expand =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">01</span>, .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">001</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-35">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># coord_cartesian(expand = F, clip = "off") +</span></span>
<span id="cb5-36">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb5-37">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Despesas mensais em diferentes categorias de alimentos"</span>,</span>
<span id="cb5-38">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Valor Total Mensal [R$]"</span>,</span>
<span id="cb5-39">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb5-40">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>,</span>
<span id="cb5-41">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption =</span> social_caption</span>
<span id="cb5-42">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-43">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_richtext</span>(</span>
<span id="cb5-44">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mapping =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(</span>
<span id="cb5-45">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Espessura da linha indica o  &lt;span style = 'color:tomato;'&gt;gasto da categoria&lt;/span&gt;. &lt;br&gt; O somatório de todas as espessuras &lt;br&gt; indica o &lt;span style = 'color:tomato;'&gt;valor total mensal&lt;/span&gt;."</span>,</span>
<span id="cb5-46">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.3</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">840</span></span>
<span id="cb5-47">    ), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4.4</span>,</span>
<span id="cb5-48">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label.color =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>,</span>
<span id="cb5-49">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Playfair Display"</span>,</span>
<span id="cb5-50">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label.padding =</span> grid<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unit</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pt"</span>)</span>
<span id="cb5-51">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-52">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb5-53">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Playfair Display"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>),</span>
<span id="cb5-54">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">35</span>, .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>),</span>
<span id="cb5-55">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.background =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_rect</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"transparent"</span>),</span>
<span id="cb5-56">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.direction =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"horizontal"</span>,</span>
<span id="cb5-57">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>),</span>
<span id="cb5-58">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.caption =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_textbox_simple</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>)</span>
<span id="cb5-59">  )</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/ima/cat_ao_tempo.jpeg" class="img-fluid figure-img" width="1500"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="gasto-mensal-e-total-dos-principais-produtos" class="level1">
<h1><strong>Gasto mensal e total dos principais produtos</strong></h1>
<p>Na última análise, consideramos as categorias que registraram o maior número de compras. Para isso, utilizamos as seguintes categorias: carboidratos, doces, bebidas, frutas e verduras. Dentro de cada uma dessas categorias, identificamos os produtos mais frequentemente adquiridos e os representamos em um único gráfico.</p>
<p>É importante mencionar que, embora o tomate seja botanicamente classificado como uma fruta, optamos por incluí-lo na categoria verdura. <em>Colocamos ele na categoria verdura pois comemos na salada e não como sobremesa!</em></p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">dft <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> base <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(categoria <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%in%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Carboidratos"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Doces"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Bebidas"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frutas"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Verduras"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(inicial <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%in%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PAO"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CHOC"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"REFRIG"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BANANA"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"TOMATE"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(mes, categoria, inicial) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarise</span>(</span>
<span id="cb6-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">valor_total =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(valor_total),</span>
<span id="cb6-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">numero =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">n</span>()</span>
<span id="cb6-8">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">inicial =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_match</span>(</span>
<span id="cb6-10">    inicial,</span>
<span id="cb6-11">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BANANA"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Banana"</span>,</span>
<span id="cb6-12">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CHOC"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Chocolate"</span>,</span>
<span id="cb6-13">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PAO"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Pão"</span>,</span>
<span id="cb6-14">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"REFRIG"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Refrigerante"</span>,</span>
<span id="cb6-15">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"TOMATE"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Tomate"</span></span>
<span id="cb6-16">  ))</span>
<span id="cb6-17"></span>
<span id="cb6-18">valor_dez <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> dft <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(mes <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Dez"</span>)</span>
<span id="cb6-19"></span>
<span id="cb6-20">tot_maximo <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> dft <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-21">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(inicial) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-22">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarise</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">total =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">round</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(valor_total))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-23">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb6-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">texto =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb6-25">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sweet Banana"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Cream Cheese Demo"</span>,</span>
<span id="cb6-26">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Bready Alternates Demo"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Loki Cola"</span>,</span>
<span id="cb6-27">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sweet Banana"</span></span>
<span id="cb6-28">    ),</span>
<span id="cb6-29">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">cor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb6-30">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gold3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"chocolate4"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"darkgoldenrod3"</span>,</span>
<span id="cb6-31">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"firebrick3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"tomato2"</span></span>
<span id="cb6-32">    )</span>
<span id="cb6-33">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-34">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">full_join</span>(valor_dez)</span>
<span id="cb6-35"></span>
<span id="cb6-36">github_icon <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&amp;#xf09b"</span></span>
<span id="cb6-37">git_gf <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"FGu5tav0"</span></span>
<span id="cb6-38">git_dv <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"DiogoVBol"</span></span>
<span id="cb6-39"></span>
<span id="cb6-40">social_caption <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> glue<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glue</span>(</span>
<span id="cb6-41">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&lt;span style='font-family:</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">Font Awesome 6 Brands</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">;'&gt;{github_icon};&lt;/span&gt;</span></span>
<span id="cb6-42"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  &lt;span style='color: #000000'&gt;{git_gf}&lt;/span&gt; &lt;br&gt; &lt;span style='font-family:</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">Font Awesome 6 Brands</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">;'&gt;{github_icon};&lt;/span&gt;</span></span>
<span id="cb6-43"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  &lt;span style='color: #000000'&gt;{git_dv}&lt;/span&gt;"</span></span>
<span id="cb6-44">)</span>
<span id="cb6-45"></span>
<span id="cb6-46"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># com facet ---------------------------------------------------------------</span></span>
<span id="cb6-47"></span>
<span id="cb6-48">dft <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-49">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-50">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> mes, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> valor_total, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">group =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-51">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">facet_wrap</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span>inicial, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ncol =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">scales =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_y"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-52">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_line</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">linewidth =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray40"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-53">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mapping =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> inicial), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pch =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">21</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray90"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">stroke =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-54">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb6-55">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb6-56">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Valor Total [R$]"</span>,</span>
<span id="cb6-57">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb6-58">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Valor mensal pago dos produtos </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">mais consumidos por categoria"</span>,</span>
<span id="cb6-59">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption =</span> social_caption</span>
<span id="cb6-60">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-61">  ggfx<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">with_shadow</span>(</span>
<span id="cb6-62">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(</span>
<span id="cb6-63">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> tot_maximo,</span>
<span id="cb6-64">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mapping =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(</span>
<span id="cb6-65">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> inicial,</span>
<span id="cb6-66">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> texto,</span>
<span id="cb6-67">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">Inf</span>,</span>
<span id="cb6-68">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> cor,</span>
<span id="cb6-69">        <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">vjust =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.4</span></span>
<span id="cb6-70">      ),</span>
<span id="cb6-71">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_x =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.3</span>,</span>
<span id="cb6-72">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>,</span>
<span id="cb6-73">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">lineheight =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb6-74">    ),</span>
<span id="cb6-75">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">colour =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray70"</span>,</span>
<span id="cb6-76">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sigma =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span></span>
<span id="cb6-77">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-78">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ylim</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-79">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_x_discrete</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">expand =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expansion</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mult =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-80">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_cartesian</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">clip =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"off"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-81">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(</span>
<span id="cb6-82">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> tot_maximo,</span>
<span id="cb6-83">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mapping =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(</span>
<span id="cb6-84">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"R$"</span>, total),</span>
<span id="cb6-85">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> cor,</span>
<span id="cb6-86">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> valor_total</span>
<span id="cb6-87">    ),</span>
<span id="cb6-88">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Banana"</span>,</span>
<span id="cb6-89">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_x =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.3</span>,</span>
<span id="cb6-90">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,</span>
<span id="cb6-91">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">lineheight =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb6-92">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-93">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_color_identity</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-94">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_fill_manual</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb6-95">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gold3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"chocolate4"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"darkgoldenrod3"</span>,</span>
<span id="cb6-96">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"firebrick3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"tomato2"</span></span>
<span id="cb6-97">  )) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-98">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">28</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-99">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb6-100">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">strip.text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb6-101">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.background =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_rect</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gray90"</span>),</span>
<span id="cb6-102">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">panel.grid.minor.y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb6-103">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb6-104">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sweet Banana"</span>),</span>
<span id="cb6-105">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">panel.grid.minor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_line</span>(),</span>
<span id="cb6-106">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>,</span>
<span id="cb6-107">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(</span>
<span id="cb6-108">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Brain Melt regular"</span>,</span>
<span id="cb6-109">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">35</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb6-110">    ),</span>
<span id="cb6-111">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.margin =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">margin</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">t =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">r =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">b =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">l =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>),</span>
<span id="cb6-112">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.caption =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_textbox_simple</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">halign =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">05</span>)</span>
<span id="cb6-113">  )</span></code></pre></div></div>
</div>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/ima/plot_teste.jpeg" class="img-fluid figure-img" width="1500"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="conclusão" class="level1">
<h1><strong>Conclusão</strong></h1>
<p>Nesse texto, demonstramos como é possível obter informações sobre seus gastos pessoais por meio de web scraping, manipulação e visualização de dados utilizando R e Python. As descobertas aqui foram de caráter exploratório, e uma nova análise com cunho estatístico será realizada em um post futuro. Surgem perguntas interessantes, como: Tenho um dia da semana preferido para ir ao mercado? Ou, a frequência de vezes que vou ao mercado pode prever o preço que gasto no mês?</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>Os códigos apresentados foram produzidos sem critérios de qualidade. Melhorias ainda podem ser feitas.</p>
</div>
</div>


</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> De volta ao topo</a> ]]></description>
  <category>R</category>
  <category>DataViz</category>
  <category>ggplot2</category>
  <guid>https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/</guid>
  <pubDate>Thu, 15 Feb 2024 03:00:00 GMT</pubDate>
  <media:content url="https://gustavofrosi.com.br/recap/2024-02-15 BananBudget1/pao_choco.jpg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>Web scraping Nota Fiscal Gaúcha</title>
  <dc:creator>Gustavo Frosi</dc:creator>
  <link>https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/</link>
  <description><![CDATA[ 





<section id="introdução" class="level1">
<h1>Introdução</h1>
<p>Você já se perguntou quanto gastou no mercado? E quais os itens que mais comprou? Bom, se você disse que não, acho melhor começar a pensar, e se você disse que sim, mas não sabe como fazer para buscar esses dados, eu tenho uma boa notícia!</p>
<p>Neste texto, descrevo como utilizei o Python na criação de um código que automatizou o download das minhas notas fiscais pessoais (NFC: Nota Fiscal de Consumidor). Deixo claro que o código é destinado ao uso pessoal e doméstico. Minha intenção é apenas o controle de gastos financeiros (e outras brincadeiras com dados).</p>
<p>O exemplo que utilizo aqui é para o site Nota Fiscal Gaúcha e serve apenas para quem utiliza o “benefício”. Fica obvio que é necessário colocar o CPF em todas as compras né.</p>
<p>Antes de começar a codificar, é necessário baixar o webdriver, uma ferramenta para testes de automação que oferece uma série de recursos para utilizar o navegador. O webdriver a ser baixado depende do navegador que você utiliza e da versão instalada. No meu caso, vou ensinar com o navegador da Google, o Google Chrome na versão 121.0.6167.140.</p>
<p>Para fazer o download do webdriver, basta acessar o <a href="https://chromedriver.chromium.org/downloads">link</a></p>
<p>Depois de baixado, é necessário colar o webdriver na pasta onde está o executável do Python. No meu caso, como utilizo o Anaconda, colei no diretório do Anaconda, o mesmo onde fica o Python.</p>
<p>Agora sim! Com isso, já é possível começar a escrever códigos.</p>
</section>
<section id="obtenção-de-dados" class="level1">
<h1>Obtenção de dados</h1>
<p>Antes de capturar qualquer nota, preciso saber quais notas tenho interesse. Para isso, fiz uma busca no site da Nota Fiscal Gaúcha, onde filtrei todas as notas do ano de 2023, apenas para o supermercado Carrefour. Assim, uma lista de dados foi apresentada (Figura&nbsp;1), onde informações de datas, estabelecimento e código da nota são expostos. Deve ser realizado o download desse arquivo em formato Excel ou CSV (ou pdf se quiser algo mais hard). Com isso, temos os dados com a chave da NFC para realizar a captura.</p>
<div id="fig-tabela" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-tabela-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/tabela.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-tabela-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;1: Planilha com os dados de cada nota fiscal de interesse
</figcaption>
</figure>
</div>
<section id="ajuste-da-chave-de-acesso" class="level2">
<h2 class="anchored" data-anchor-id="ajuste-da-chave-de-acesso">Ajuste da chave de acesso</h2>
<p>Da planilha baixada do site, apenas a coluna que contém a chave de acesso da nota fiscal é relevante. Realizei uma pequena manipulação na planilha, removendo os espaços da coluna da chave de acesso, e a salvei como arquivo CSV.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>Códigos em R</p>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"></span>
<span id="cb1-3">dados <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> readxl<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_excel</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nota Fiscal Gaúcha.xlsx"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-4">  janitor<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">clean_names</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chave =</span> chave_de_acesso <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_remove_all</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">s"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(chave)</span>
<span id="cb1-7"></span>
<span id="cb1-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">write.csv</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> dados, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">file =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"notas/para_auto.csv"</span>)</span></code></pre></div></div>
</div>
</section>
<section id="encontrando-os-pontos-de-clique" class="level2">
<h2 class="anchored" data-anchor-id="encontrando-os-pontos-de-clique">Encontrando os pontos de clique</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>Agora serão apenas códigos em python</p>
</div>
</div>
<p>O procedimento que apresento aqui é baseado em um algoritmo que controla o mouse do computador, realizando cliques e movimentos programados. Como é de se esperar, é necessário fornecer as coordenadas para guiar os movimentos. Essa é uma tarefa manual, porém, é realizada apenas uma vez e se aplica a todas as notas (baixei mais de 200 notas).</p>
<p>Utilizei o MouseInfo para identificar os pontos. Após abrir o console do python (melhor fazer pelo console) é só dar os seguintes comandos:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> mouseinfo <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> mouseInfo</span>
<span id="cb2-2"></span>
<span id="cb2-3">mouseInfo()</span></code></pre></div></div>
</div>
<p>O vídeo abaixo demonstra o funcionamento do MouseInfo, exibindo as marcações das coordenadas x e y à medida que o mouse é movido.</p>
<p><video src="clicks%20-%201707185627966.mp4" class="img-fluid" controls=""><a href="clicks - 1707185627966.mp4">Video</a></video></p>
<p>Para encontar os ponto certo basta realizar um teste com o MouseInfo aberto. Abra o <a href="https://www.sefaz.rs.gov.br/ASP/AAE_ROOT/NFE/SAT-WEB-NFE-NFC_1.asp?HML=&amp;chaveNFe=">site</a> onde as notas serão baixadas e identifique os pontos onde será necessário realizar os cliques. O atalho <strong>F6</strong> pode ser utilizado no MouseInfo para marcar as pontos x e y. Siga os passo:</p>
<p>1º Passo: Clique em avançar e depois em imprimir Figura&nbsp;2</p>
<div id="fig-prime" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-prime-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/passo a passo/primeira.png" id="fig-prime" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-prime-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;2
</figcaption>
</figure>
</div>
<p>2º Passo: Clique em imprimir na parte do pdf Figura&nbsp;3</p>
<div id="fig-seg" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-seg-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/passo a passo/segunda.png" id="fig-seg" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-seg-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;3
</figcaption>
</figure>
</div>
<p>3º Passo: Clique em salvar Figura&nbsp;4</p>
<div id="fig-ter" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-ter-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/passo a passo/terceira.png" id="fig-ter" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-ter-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figura&nbsp;4
</figcaption>
</figure>
</div>
<p>Por padrão, o Windows salva na pasta de downloads, mas é possível alterar para a pasta desejada. Basta encontrar o ponto de clique e realizar a mudança de destino.</p>
</section>
</section>
<section id="código-para-o-web-scraping" class="level1">
<h1>Código para o Web scraping</h1>
<p>Para o web scraping, eu utilizei basicamente dois pacotes: o PyAutoGUI e o Selenium. O primeiro realiza o controle do mouse e o preenchimento dos campos, enquanto o Selenium cuida de toda a parte de abrir o navegador e entrar nos links.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pyautogui</span>
<span id="cb3-2"></span>
<span id="cb3-3"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> selenium <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> webdriver</span></code></pre></div></div>
</div>
<p>O próximo bloco de código mostra toda a parte de acesso ao navegador de forma autônoma. Inclui a definição do tamanho da janela, o que é importante, pois o tamanho afeta a disposição dos botões e, consequentemente, o local dos cliques. Por fim, há a parte que abre o navegador e acessa o link da nota fiscal.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1">options <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> webdriver.ChromeOptions()</span>
<span id="cb4-2">navegador <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> webdriver.Chrome(options<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>options)</span>
<span id="cb4-3"></span>
<span id="cb4-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Definindo o tamanho da janela do navegador</span></span>
<span id="cb4-5">navegador.set_window_size(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1280</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">780</span>)</span>
<span id="cb4-6"></span>
<span id="cb4-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Link para baixar</span></span>
<span id="cb4-8">link1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"https://www.sefaz.rs.gov.br/NFE/NFE-NFC.aspx?chaveNFe="</span></span>
<span id="cb4-9"></span>
<span id="cb4-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Abre o navegador com o link fornecido</span></span>
<span id="cb4-11">navegador.get(link1)</span></code></pre></div></div>
</div>
<p>A última parte é onde ocorre o loop, ou seja, a captação nota a nota. Para isso, importei o arquivo “para_auto.csv”. Este arquivo contém a coluna com as chaves das notas fiscais. A coluna “linha” foi separada utilizando a função “split()”, considerando o separador “,”. Em seguida, foi realizada a substituição das aspas duplas com a função “replace()”. Com isso, a chave de acesso estava pronta para ser utilizada.</p>
<p>O novo link foi gerado considerando a primeira parte do link do site mais a parte numérica que contém a chave de acesso. A função “get()” abriu o navegador e, assim, o PyAutoGUI realizou os cliques nas coordenadas definidas.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">with</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">open</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"para_auto.csv"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"r"</span>) <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> arquivo:</span>
<span id="cb5-2">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> linha <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> arquivo:</span>
<span id="cb5-3">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Separa a coluna linha pela ","</span></span>
<span id="cb5-4">        chave_nota <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> linha.split(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">','</span>)[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="cb5-5">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Substitui um aspa dupla por nada</span></span>
<span id="cb5-6">        chave_nota <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> chave_nota.replace(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'"'</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">''</span>)</span>
<span id="cb5-7">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Cria um link com o site e a chave da nota</span></span>
<span id="cb5-8">        link <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> link1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> chave_nota</span>
<span id="cb5-9">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Abre o navegador com o link novo</span></span>
<span id="cb5-10">        navegador.get(link)</span>
<span id="cb5-11">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># clica no avançar</span></span>
<span id="cb5-12">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">78</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">310</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb5-13">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># clica no 1º imprimir</span></span>
<span id="cb5-14">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1188</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">164</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)    </span>
<span id="cb5-15">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># clica no segundo imprimir</span></span>
<span id="cb5-16">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">676</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">168</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb5-17">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># clica no tipo de pdf</span></span>
<span id="cb5-18">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">676</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">212</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb5-19">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># clica para selecionar o tipo de pdf 2</span></span>
<span id="cb5-20">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">647</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">525</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb5-21">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># clica em imprimir final pdf</span></span>
<span id="cb5-22">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">175</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">395</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb5-23">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Coloca o número da nota como nome do arquivo</span></span>
<span id="cb5-24">        pyautogui.write(chave_nota)</span>
<span id="cb5-25">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Clica em salvar </span></span>
<span id="cb5-26">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">553</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">465</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb5-27">        pyautogui.click(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">767</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">35</span>, duration<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb5-28">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fecha o navegador</span></span>
<span id="cb5-29">    navegador.close()</span></code></pre></div></div>
</div>
<section id="resultado" class="level2">
<h2 class="anchored" data-anchor-id="resultado">Resultado</h2>
<p>O vídeo exibe o “robô” em ação, realizando a impressão e salvando automaticamente cada uma das notas. Na minha análise, as 205 notas que obtive foram processadas em quase 21 minutos, o que equivale a ~6 segundos por nota (Um computador melhor fará em menos tempo). E você, ocupado com diversas tarefas, conseguiria realizar isso de maneira mais rápida? Mesmo ao atingir a nota de número 100 e perceber que ainda falta mais da metade. Se acha que não, a resposta para isso é simples: <strong>programação!</strong></p>
<p><video src="resultado.mp4" class="img-fluid" controls=""><a href="resultado.mp4">Video</a></video></p>
<p>E agora, o que fazer com essas notas? Começar a extrair os dados manualmente? Pagar alguém para fazer? Excluir do computador e dar um ponto final?</p>
<p>A resposta óbvia é sim, dar um ponto final e excluir. No entanto, se ainda assim você deseja extrair informações dos seus dados, eu aconselho a conferir um próximo post (no futuro), no qual explico o que fazer com as notas.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>Os códigos apresentados foram produzidos sem critérios de qualidade. Melhorias ainda podem ser feitas.</p>
</div>
</div>


</section>
</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> De volta ao topo</a><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citação</h2><div><div class="quarto-appendix-secondary-label">BibTeX</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{frosi2024,
  author = {Frosi, Gustavo},
  title = {Web scraping Nota Fiscal Gaúcha},
  date = {2024-02-06},
  url = {https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/},
  doi = {10.59350/k3qdt-7h328},
  langid = {pt}
}
</code></pre><div class="quarto-appendix-secondary-label">Por favor, cite este trabalho como:</div><div id="ref-frosi2024" class="csl-entry quarto-appendix-citeas">
Frosi, Gustavo. 2024. <span>“Web scraping Nota Fiscal Gaúcha.”</span>
February 6. <a href="https://doi.org/10.59350/k3qdt-7h328">https://doi.org/10.59350/k3qdt-7h328</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>python</category>
  <category>Web scraping</category>
  <guid>https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/</guid>
  <pubDate>Tue, 06 Feb 2024 03:00:00 GMT</pubDate>
  <media:content url="https://gustavofrosi.com.br/recap/2024-02-05 webscraping python/logo.jpg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>Trabalhos - XXIII CLACS | XXXVIII CBCS</title>
  <dc:creator>Gustavo Frosi</dc:creator>
  <dc:creator>Dayana Eckert</dc:creator>
  <link>https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/</link>
  <description><![CDATA[ 





<section id="introdução" class="level1">
<h1>Introdução</h1>
<p>O Congresso Brasileiro de Ciência do Solo (CBCS) é um evento técnico-científico que ocorre a cada dois anos (anos ímpares). O objetivo deste evento é reunir alunos, professores, pesquisadores e profissionais das áreas afins para a troca de conhecimento e discussão sobre as futuras perspectivas da ciência do solo.</p>
<p>Esse ano o XXXVIII CBCS ocorreu em Florianopolis – SC, concomitante a ele ocorreu o XXIII Congresso Latino-Americado de Ciência do solo (CLACS). O evento em conjunto foi chamado de SOLOS FLORIPA 2023, com organização das sociedades Latino-americana (SLCS) e Brasileira (SBCS) da Ciência do Solo e realização da Empresa de Pesquisa Agropecuária e Extensão Rural de Santa Catarina (Epagri).</p>
<p>Uma das características mais importante do congresso é a possibilidade de os “pesquisadores” apresentarem trabalhos técnico-científicos sobre seus respectivos objetos de estudo. Diante disso, surge a dúvida em saber quais as áreas/subáreas teve as maiores quantidades de trabalhos apresentados e talvez entender o foco das pesquisas em Ciência do Solo na atualidade. Para sanar essa dúvida (pelo menos parcialmente) apresento nesse post uma forma de retirar os dados do site do congresso e realizar uma apresentação gráfica sobre os trabalhos. Para isso utilizo a linguagem de programação R.</p>
<p>Para mais informações acesse o site: <strong>Site fora do ar</strong></p>
</section>
<section id="pacotes" class="level1">
<h1>Pacotes</h1>
<p>Para essa análise vou utilizar os seguintes pacotes do R</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(pdftools)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(rvest)</span>
<span id="cb1-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(httr)</span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(showtext)</span>
<span id="cb1-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggtext)</span></code></pre></div></div>
</details>
</div>
<p>Atualmente, a <strong>SBCS</strong> possui <strong>4</strong> divisões científicas com 16 subdivisões, sendo:</p>
<ul>
<li><ol type="1">
<li>Solo no espaço e no tempo</li>
</ol>
<ul>
<li>1.1. Gênese e Morfologia do Solo</li>
<li>1.2. Levantamento e Classificação do Solo</li>
<li>1.3. Pedometria</li>
<li>1.4. Paleopedologia</li>
</ul></li>
<li><ol start="2" type="1">
<li>Processos e propriedades do solo</li>
</ol>
<ul>
<li>2.1. Biologia do Solo;</li>
<li>2.2. Física do Solo</li>
<li>2.3. Mineralogia do Solo</li>
<li>2.4. Química do Solo</li>
</ul></li>
<li><ol start="3" type="1">
<li>Uso e manejo do solo</li>
</ol>
<ul>
<li>3.1. Fertilidade do Solo e Nutrição de Plantas</li>
<li>3.2. Corretivos e Fertilizantes</li>
<li>3.3. Manejo e Conservação do Solo e da Água</li>
<li>3.4. Planejamento do Uso da Terra</li>
<li>3.5. Poluição, Remediação do Solo e Recuperação de Áreas Degradadas</li>
</ul></li>
<li>4.Solos, ambiente e sociedade
<ul>
<li>4.1. Educação em Solos e Percepção Pública do Solo</li>
<li>4.2. Solos e Segurança Alimentar</li>
<li>4.3. História, Epistemiologia e Sociologia da Ciência do Solo</li>
</ul></li>
</ul>
<section id="dados" class="level2">
<h2 class="anchored" data-anchor-id="dados">Dados</h2>
<p>Os dados do número de trabalhos está na página de <strong>Trabalho Aprovados</strong> no site. A captura dos dados foi realizada com o endereço eletrônico da página. Um avaliação prévia de como se conportava a página e como os dados aparaciam foi realizada.</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1">primeira_parte <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"https://solosfloripa2023.com.br/evento/solos2023/trabalhosaprovados?titulo=&amp;autor=&amp;t1area_id="</span></span>
<span id="cb2-2"></span>
<span id="cb2-3">id <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">13</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">14</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>)</span>
<span id="cb2-4"></span>
<span id="cb2-5">segunda_parte <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&amp;modeloformaapresentacaofinal_id=&amp;btBuscar=Buscar"</span></span></code></pre></div></div>
</details>
</div>
<p>Um loop foi realizado para remover os dados de cada uma das áreas e subareas.</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">df <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.data.frame</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(id))</span>
<span id="cb3-2"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> (i <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>) {</span>
<span id="cb3-3">  dados <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> httr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">GET</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste0</span>(primeira_parte, id[i], segunda_parte))</span>
<span id="cb3-4">  get_content <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> httr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">content</span>(dados)</span>
<span id="cb3-5"></span>
<span id="cb3-6">  raw_table <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> get_content <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb3-7">    rvest<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">html_nodes</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">".container-fluid"</span>)</span>
<span id="cb3-8"></span>
<span id="cb3-9">  df[i, ] <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span id="cb3-10">    raw_table[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>]] <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb3-11">    rvest<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">html_text</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb3-12">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">strsplit</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb3-13">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unlist</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb3-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">enframe</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">name =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">value =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"linha"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb3-15">    dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(stringr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_detect</span>(linha, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">".*registro"</span>))</span>
<span id="cb3-16">}</span></code></pre></div></div>
</details>
</div>
<p>Além de captar as iformações, foi realizado um processamento e manipulação para organizar os dados.</p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">divi <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> raw_table[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>]] <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-2">  rvest<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">html_text</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">strsplit</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unlist</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">enframe</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">name =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">value =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"linha"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-6">  dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(stringr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_detect</span>(linha, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" TODASDivisã"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_split</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Di"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">simplify =</span> T) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.data.frame</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pivot_longer</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">cols =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">names_to =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divi"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values_to =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"nome"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Divi <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">di =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Di"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">transmute</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Divi =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(di, nome, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sep =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>))</span>
<span id="cb4-13"></span>
<span id="cb4-14"></span>
<span id="cb4-15">d_final <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cbind</span>(divi, df)</span>
<span id="cb4-16"></span>
<span id="cb4-17">dados.ok <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> d_final <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb4-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb4-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">partici =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_extract</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">1:length(id)</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>,</span>
<span id="cb4-20">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pattern =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"[:digit:]{1,}"</span></span>
<span id="cb4-21">    ),</span>
<span id="cb4-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">partici =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(partici)</span>
<span id="cb4-23">  ) </span>
<span id="cb4-24"></span>
<span id="cb4-25"></span>
<span id="cb4-26">comi <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_split</span>(d_final<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Divi, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">":"</span>)</span>
<span id="cb4-27">data_separado <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">do.call</span>(rbind, comi))</span>
<span id="cb4-28"></span>
<span id="cb4-29">df_ok <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cbind</span>(data_separado, dados.ok)</span>
<span id="cb4-30"></span>
<span id="cb4-31">df_ok <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> df_ok <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">remover =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_sub</span>(df_ok<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>X2, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">start =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">end =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>))</span>
<span id="cb4-32"></span>
<span id="cb4-33"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">font_add</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Didot"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"GFS_Didot/GFSDidot-Regular.ttf"</span>)</span>
<span id="cb4-34"></span>
<span id="cb4-35"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">showtext_auto</span>()</span></code></pre></div></div>
</details>
</div>
</section>
</section>
<section id="resultados" class="level1">
<h1>Resultados</h1>
<p>Com os dados devidamente organizados foi realizado a visualização gráfica.</p>
<section id="trabalhos-dentro-de-cada-divisão" class="level2">
<h2 class="anchored" data-anchor-id="trabalhos-dentro-de-cada-divisão">Trabalhos dentro de cada divisão</h2>
<div class="tabset-margin-container"></div><div class="panel-tabset">
<ul class="nav nav-tabs"><li class="nav-item"><a class="nav-link active" id="tabset-1-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-1" aria-controls="tabset-1-1" aria-selected="true" href="">Divisão 1</a></li><li class="nav-item"><a class="nav-link" id="tabset-1-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-2" aria-controls="tabset-1-2" aria-selected="false" href="">Divisão 2</a></li><li class="nav-item"><a class="nav-link" id="tabset-1-3-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-3" aria-controls="tabset-1-3" aria-selected="false" href="">Divisão 3</a></li><li class="nav-item"><a class="nav-link" id="tabset-1-4-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-4" aria-controls="tabset-1-4" aria-selected="false" href="">Divisão 4</a></li></ul>
<div class="tab-content">
<div id="tabset-1-1" class="tab-pane active" aria-labelledby="tabset-1-1-tab">
<p><img src="https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/ima_graph/unnamed-chunk-5-1.png" class="img-fluid"></p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1">df_ok <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(X1 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 1 – Solo no espaço e no tempo"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb5-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> partici, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_reorder</span>(remover, partici))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#ef8118"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#bc6a1d"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-6">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># facet_wrap(~X1, scales = "free") +</span></span>
<span id="cb5-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb5-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nº de trabalhos"</span>,</span>
<span id="cb5-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Resumos no &lt;span style = "color:#ef8118"&gt; XXIII CLACS | XXXVIII CBCS &lt;/span&gt;'</span>,</span>
<span id="cb5-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 1 – Solo no espaço e no tempo"</span></span>
<span id="cb5-11">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> partici), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_y =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb5-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb5-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Didot"</span>),</span>
<span id="cb5-16">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> ggtext<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_markdown</span>()</span>
<span id="cb5-17">  )</span></code></pre></div></div>
</details>
</div>
</div>
<div id="tabset-1-2" class="tab-pane" aria-labelledby="tabset-1-2-tab">
<p><img src="https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/ima_graph/unnamed-chunk-6-1.png" class="img-fluid"></p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">df_ok <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(X1 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 2 – Processos e Propriedades do Solo"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb6-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> partici, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_reorder</span>(remover, partici))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#ef8118"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#bc6a1d"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-6">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># facet_wrap(~X1, scales = "free") +</span></span>
<span id="cb6-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb6-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nº de trabalhos"</span>,</span>
<span id="cb6-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Resumos no &lt;span style = "color:#ef8118"&gt; XXIII CLACS | XXXVIII CBCS &lt;/span&gt;'</span>,</span>
<span id="cb6-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 2 – Processos e Propriedades do Solo"</span></span>
<span id="cb6-11">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> partici), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_y =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb6-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb6-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Didot"</span>),</span>
<span id="cb6-16">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title  =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_markdown</span>()</span>
<span id="cb6-17">  )</span></code></pre></div></div>
</details>
</div>
</div>
<div id="tabset-1-3" class="tab-pane" aria-labelledby="tabset-1-3-tab">
<p><img src="https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/ima_graph/unnamed-chunk-7-1.png" class="img-fluid"></p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1">df_ok <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb7-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(X1 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 3 – Uso e Manejo do Solo"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb7-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">remover =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">factor</span>(remover, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">levels =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb7-4">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" Fertilidade do Solo e Nutrição de Plantas"</span>,</span>
<span id="cb7-5">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" Corretivos e Fertilizantes"</span>, </span>
<span id="cb7-6">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" Manejo e Conservação do Solo e da Água"</span>, </span>
<span id="cb7-7">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" Planejamento do Uso da Terra"</span>, </span>
<span id="cb7-8">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" Poluição, Remediação do Solo e Recuperação de Áreas Degradadas"</span></span>
<span id="cb7-9">), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">labels =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb7-10">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilidade do Solo e </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> Nutrição de Plantas"</span>,</span>
<span id="cb7-11">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Corretivos e Fertilizantes"</span>,</span>
<span id="cb7-12">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Manejo e Conservação </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> do Solo e da Água"</span>,</span>
<span id="cb7-13">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Planejamento do Uso da Terra"</span>,</span>
<span id="cb7-14">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Poluição, Remediação do Solo e </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> Recuperação de Áreas Degradadas"</span></span>
<span id="cb7-15">))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb7-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> partici, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_reorder</span>(remover, partici))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb7-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb7-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#ef8118"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#bc6a1d"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb7-19">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># facet_wrap(~X1, scales = "free") +</span></span>
<span id="cb7-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb7-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nº de trabalhos"</span>,</span>
<span id="cb7-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Resumos no &lt;span style = "color:#ef8118"&gt; XXIII CLACS | XXXVIII CBCS &lt;/span&gt;'</span>,</span>
<span id="cb7-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 3 – Uso e Manejo do Solo"</span></span>
<span id="cb7-24">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb7-25">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> partici), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_y =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">13</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb7-26">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb7-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb7-28">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Didot"</span>),</span>
<span id="cb7-29">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_markdown</span>()</span>
<span id="cb7-30">  )</span></code></pre></div></div>
</details>
</div>
</div>
<div id="tabset-1-4" class="tab-pane" aria-labelledby="tabset-1-4-tab">
<p><img src="https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/ima_graph/unnamed-chunk-8-1.png" class="img-fluid"></p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1">df_ok <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(X1 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 4 - Solo, Ambiente e Sociedade"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">remover =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">factor</span>(remover, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">labels =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb8-4">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Educação em Solos e </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> Percepção Pública do Solo"</span>,</span>
<span id="cb8-5">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"História, Epistemologia e </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> Sociologia da Ciência"</span>,</span>
<span id="cb8-6">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Solos e Segurança Alimentar"</span></span>
<span id="cb8-7">  ))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> partici, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_reorder</span>(remover, partici))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb8-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb8-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#ef8118"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#bc6a1d"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb8-11">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># facet_wrap(~X1, scales = "free") +</span></span>
<span id="cb8-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb8-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nº de trabalhos"</span>,</span>
<span id="cb8-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Resumos no &lt;span style = "color:#ef8118"&gt; XXIII CLACS | XXXVIII CBCS &lt;/span&gt;'</span>,</span>
<span id="cb8-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 4 - Solo, Ambiente e Sociedade"</span></span>
<span id="cb8-16">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb8-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> partici), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_y =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb8-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb8-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb8-20">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Didot"</span>),</span>
<span id="cb8-21">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title  =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_markdown</span>()</span>
<span id="cb8-22">  )</span></code></pre></div></div>
</details>
</div>
</div>
</div>
</div>
</section>
<section id="trabalhos-entre-as-divisões" class="level2">
<h2 class="anchored" data-anchor-id="trabalhos-entre-as-divisões">Trabalhos entre as divisões</h2>
<p>De forma geral, observa-se que a maioria dos trabalhos submetidos e apresentados no evento pertence à divisão científica 3 – Uso e Manejo do Solo, totalizando 829 trabalhos. Em contrapartida, a divisão 4 – Solo, Ambiente e Sociedade apresentou o menor número de trabalhos, com apenas 58.</p>
<p><img src="https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/ima_graph/unnamed-chunk-9-1.png" class="img-fluid"></p>
<div class="cell">
<details class="code-fold">
<summary>Código</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1">df_ok <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(X1) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarise</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">soma =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(partici)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb9-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">X1 =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">factor</span>(X1, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">labels =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(</span>
<span id="cb9-6">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 1 – Solo no </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> espaço e no tempo"</span>,</span>
<span id="cb9-7">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 2 – Processos e </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  Propriedades do Solo"</span>,</span>
<span id="cb9-8">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 3 – Uso e </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> Manejo do Solo"</span>,</span>
<span id="cb9-9">      <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Divisão 4 - Solo, </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> Ambiente e Sociedade"</span></span>
<span id="cb9-10">    )),</span>
<span id="cb9-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">total =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(soma)</span>
<span id="cb9-12">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> soma, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fct_reorder</span>(X1, soma))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#ef8118"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#bc6a1d"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-16">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># facet_wrap(~X1, scales = "free") +</span></span>
<span id="cb9-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb9-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nº de trabalhos"</span>,</span>
<span id="cb9-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Resumos no &lt;span style = "color:#ef8118"&gt; XXIII CLACS | XXXVIII CBCS &lt;/span&gt;'</span>,</span>
<span id="cb9-20">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Total por divisão"</span></span>
<span id="cb9-21">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-22">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label =</span> soma), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nudge_y =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-23">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-24">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb9-25">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">text =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Didot"</span>),</span>
<span id="cb9-26">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_markdown</span>()</span>
<span id="cb9-27">  )</span></code></pre></div></div>
</details>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Nota
</div>
</div>
<div class="callout-body-container callout-body">
<p>Os códigos apresentados foram produzidos sem critérios de qualidade. Melhorias ainda podem ser feitas.</p>
</div>
</div>


</section>
</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> De volta ao topo</a> ]]></description>
  <category>R</category>
  <category>Solos</category>
  <guid>https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/</guid>
  <pubDate>Sun, 17 Dec 2023 03:00:00 GMT</pubDate>
  <media:content url="https://gustavofrosi.com.br/recap/2023-12-17 CBCS 2023/logo.png" medium="image" type="image/png" height="70" width="144"/>
</item>
</channel>
</rss>
