envio com inclusão da linha de ugms, mas falta resolver a inclusão da linha e outras coisas.

This commit is contained in:
2023-09-28 15:25:12 -03:00
parent 7a544c3c93
commit 6cfa773444
8 changed files with 2976 additions and 158 deletions

26
EvolucaoVitruvio.R Normal file
View File

@ -0,0 +1,26 @@
library (data.table)
library(tidyr)
library(dplyr)
library (ggplot2)
Evol_exist <- fread("data/Tabela4.csv", check.names =FALSE, header=TRUE)
str(Evol_exist)
#Transpor a tabela
Evol_exist1<-dcast(melt(Evol_exist, id.vars="Ano"),variable ~Ano)
# deu um trabalho para n ão aparecer uma linha nova com os nomes da colunas...
str(Evol_exist1)
Evoluc<-Evol_exist1%>%
pivot_longer(!variable, names_to="Categoria", values_to="Cabecas")%>%
dplyr::mutate(Ano=variable)
#View(Evoluc)
str(Evoluc)
Evoluc<-ggplot(Evoluc, aes(x=Ano, y=Cabecas, group = Categoria))+
geom_line (aes(color=Categoria))+
geom_point(aes(color=Categoria))
getwd()
png(filename="fig/Evoluc1.png")
plot(Evoluc)
Evoluc

1324
EvolucaoVitruvio.html Normal file

File diff suppressed because it is too large Load Diff

1520
EvolucaoVitruvio.html~ Normal file

File diff suppressed because it is too large Load Diff

View File

@ -61,13 +61,13 @@ Os dados da tabela 2 refletem a composição de um rebanho com finalidade de pro
#+NAME: C_ideal
| | Categoria de animais | Cabeças | %cab% | UGM | %UGM |
|---+-----------------------+---------+-------+------+-------|
| # | Vacas em lactação | 10 | 47.6 | 10 | 60.6 |
| # | Vacas em lactação | 18 | 51.4 | 18 | 76.9 |
| # | Vacas secas | 2 | 9.5 | 2 | 12.1 |
| # | Bezerras ate 12 meses | 3 | 14.3 | 0.75 | 4.5 |
| # | Novilhas até 18 meses | 3 | 14.3 | 1.5 | 9.1 |
| # | Novilhas até 24 meses | 3 | 14.3 | 2.25 | 13.6 |
| # | Bezerras ate 12 meses | 10 | 32.3 | 2.5 | 2.8 |
| # | Novilhas até 18 meses | 3 | 9.1 | 1.5 | 6.2 |
| # | Novilhas até 24 meses | 0 | 0.0 | 0. | 0.0 |
| # | Outros animais | | 0.0 | 0 | 0.0 |
| # | Total | 21 | 100.0 | 16.5 | 100.0 |
| # | Total | 33 | 100.0 | 24. | 100.0 |
| ^ | | Tcab | | Tugm | |
|---+-----------------------+---------+-------+------+-------|
#+TBLFM: $4=$3*100/$Tcab;%.1f::@2$5=@2$3*remote(Tab1,@2$2)::@8$3=@2$3+@3$3+@4$3+@5$3+@6$3+@7$3::@3$5=@3$3*remote(Tab1, @3$2)::@4$5=@4$3*remote(Tab1, @4$2)::@5$5=@5$3*remote(Tab1, @5$2)::@6$5=@6$3*remote(Tab1, @6$2)::@7$5=@7$3*remote(Tab1, @7$2)::@8$5=vsum(@2..@7)::$6=$5*100/$Tugm;%.1f
@ -95,28 +95,28 @@ As tabelas de composição de rebanho serão calculadas automáticamente, com ba
| | Partos/vaca/ano | 1 | 1 | 1 | 1 | 1 | 1 | |
| ^ | | PV1 | PV2 | PV3 | PV4 | PV5 | PV6 | |
|---+------------------------+-------+-------+-------+-------+-------+--------+--------------|
| | Vacas Existentes | 20 | - | - | - | - | - | - a calcular |
| | Vacas Existentes | 00 | - | - | - | - | - | - a calcular |
| ^ | | VE1 | | | | | | |
| | Novilhas exist. | 05 | - | - | - | - | - | - a calcular |
| | Novilhas exist. | 00 | - | - | - | - | - | - a calcular |
| ^ | | NE1 | | | | | | |
| | Bezerras existentes | 0 | - | - | - | - | - | - a calcular |
| ^ | | TE1 | | | | | | |
|---+------------------------+-------+-------+-------+-------+-------+--------+--------------|
| | Novilhas >- vacas | 0 | 0 | 0 | 0 | 0 | 0 | NÃO ALTERAR |
| ^ | | TN1 | TN2 | TN3 | TN4 | TN5 | TN6 | |
| | % Bezerras -> novilhas | 0.4 | 0.4 | 0.4 | 0.4 | 0.4 | 0.4 | % S_Nascidos |
| | % Bezerras -> novilhas | 0.4 | 0.4 | 0.75 | 0.7 | 0.7 | 0.7 | % S_Nascidos |
| ^ | | BA1 | BA2 | BA3 | BA4 | BA5 | BA6 | |
|---+------------------------+-------+-------+-------+-------+-------+--------+--------------|
| | Vacas a vender | 0 | 0 | 0 | 6 | 14 | 9 | |
| | Vacas a vender | 0 | 0 | 0 | 0 | 5 | 4 | |
| ^ | | VV1 | VV2 | VV3 | VV4 | VV5 | VV6 | |
| | Novilhas a vender | 0 | 0 | 0 | 0 | 7 | 8 | |
| | Novilhas a vender | 0 | 0 | 0 | 0 | 0 | 0 | |
| ^ | | NV1 | NV2 | NV3 | NV4 | NV5 | NV6 | |
| | Bezerras a vender | 0 | 0 | 0 | 0 | 0 | 0 | |
| | Bezerras a vender | 0 | 4 | 10 | 12 | 15 | 14 | |
| ^ | | BV1 | BV2 | BV3 | BV4 | BV5 | BV6 | |
|---+------------------------+-------+-------+-------+-------+-------+--------+--------------|
| | Vacas a comprar | 0 | 0 | 0 | 0 | 0 | 0 | |
| ^ | | VC1 | VC2 | VC3 | VC4 | VC5 | VC6 | |
| | Novilhas a comprar | 2 | 0 | 0 | 0 | 0 | 0 | |
| | Novilhas a comprar | 20 | 0 | 0 | 0 | 0 | 0 | |
| ^ | | NC1 | NC2 | NC3 | NC4 | NC5 | NC6 | |
| | Bezerras a compras | 0 | 0 | 0 | 0 | 0 | 0 | |
| ^ | | BC1 | BC2 | BC3 | BC4 | BC5 | BC6 | |
@ -140,11 +140,11 @@ Temos o seguinte:
#+NAME: Tab3_1
| | Categoria | ExttAnt | TIR | Compra | Venda | Saldo | TIC | ExttFin |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
| # | VACAS >24 | 20 | 0 | 0 | 0 | 20 | 0 | 20 |
| # | VACAS >24 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| ^ | | EAV | TRV | COV | VEV | SAV | TCV | EFV |
| # | NOVILHAS 12<>24 | 5 | 0 | 2 | 0 | 7 | 7 | 0 |
| # | NOVILHAS 12<>24 | 0 | 0 | 20 | 0 | 20 | 20 | 0 |
| ^ | | EAN | TRN | CON | VEN | SAN | TCN | EFN |
| # | BEZERRAS <12 | 0 | 8 | 0 | 0 | 8 | 8 | 0 |
| # | BEZERRAS <12 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| ^ | | EAB | FRB | COB | VEB | SAB | TCB | EFB |
| # | Outros | | 0 | 0 | 0 | | 0 | 0 |
| ^ | | EAO | FRO | COO | VEO | SAO | TCO | EFO |
@ -160,13 +160,13 @@ Na tabela 4 consta o número de animais para cada categoria, com as ocorrencias
#+NAME: Tab3_2
| | CATEGORIA | EXTTANT | TIR | COMPRA | VENDA | SALDO | TIC | EXTTFIN |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
| # | VACAS >24 | 20 | 7 | 0 | 0 | 27 | 0 | 27 |
| # | VACAS >24 | 0 | 20 | 0 | 0 | 20 | 0 | 20 |
| ^ | | EAV | TRV | COV | VEV | SAV | TCV | EFV |
| # | Novilhas 12<>24 | 0 | 8 | 0 | 0 | 8 | 8 | 0 |
| # | Novilhas 12<>24 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| ^ | | EAN | TRN | CON | VEN | SAN | TCN | EFN |
| # | Bezerras <12 | 0 | 11 | 0 | 0 | 11 | 11 | 0 |
| # | Bezerras <12 | 0 | 8 | 0 | 4 | 4 | 4 | 0 |
| ^ | | EAB | FRB | COB | VEB | SAB | TCB | EFB |
| # | outros | 1 | | | | 1 | | 1 |
| # | outros | | | | | | | |
| ^ | | EAO | FRO | COO | VEO | SAO | TCO | EFO |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
#+TBLFM: $EAV=remote(Tab3_1, $EFV)::$TRV=remote(Tab3_1, $TCN)::$COV=remote(Tab0,$VC2)::$VEV=remote(Tab0, $VV2)::$SAV=$EAV+$TRV+$COV-$VEV::$EFV=$SAV::$EAN=remote(Tab3_1, $EFN)::$TRN=remote(Tab3_1, $TCB)::$CON=remote(Tab0,$NC2)::$VEN=remote(Tab0, $NV2)::$SAN=$EAN+$TRN+$CON-$VEN::$TCN=$SAN::$EFN=$SAN-$TCN::$EAB=remote(Tab3_1, $EFB)::$FRB=$EFV*remote(Tab0, $BA2);%.0f::$COB=remote(Tab0,$BC2)::$VEB=remote(Tab0,$BV2)::$SAB=$EAB+$FRB+$COB-$VEB::$TCB=$SAB::$EFB=$SAB-$TCB
@ -179,13 +179,13 @@ Na tabela 3.3 podemos observar...
#+NAME: Tab3_3
| | CATEGORIA | EXTTANT | TIR | COMPRA | VENDA | SALDO | TIC | EXTTFIN |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
| # | VACAS >24 | 27 | 8 | 0 | 0 | 35 | 0 | 35 |
| # | VACAS >24 | 20 | 0 | 0 | 0 | 20 | 0 | 20 |
| ^ | | EAV | TRV | COV | VEV | SAV | TCV | EFV |
| # | Novilhas 12<>24 | 0 | 11 | 0 | 0 | 11 | 11 | 0 |
| # | Novilhas 12<>24 | 0 | 4 | 0 | 0 | 4 | 4 | 0 |
| ^ | | EAN | TRN | CON | VEN | SAN | TCN | EFN |
| # | Bezerras <12 | 0 | 14 | 0 | 0 | 14 | 14 | 0 |
| # | Bezerras <12 | 0 | 15 | 0 | 10 | 5 | 5 | 0 |
| ^ | | EAB | FRB | COB | VEB | SAB | TCB | EFB |
| # | outros | 1 | | | | 1 | | 1 |
| # | outros | | | | | | | |
| ^ | | EAO | FRO | COO | VEO | SAO | TCO | EFO |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
#+TBLFM: $EAV=remote(Tab3_2, $EFV)::$TRV=remote(Tab3_2, $TCN)::$COV=remote(Tab0,$VC3)::$VEV=remote(Tab0, $VV3)::$SAV=$EAV+$TRV+$COV-$VEV::$EFV=$SAV::$EAN=remote(Tab3_2, $EFN)::$TRN=remote(Tab3_2, $TCB)::$CON=remote(Tab0,$NC3)::$VEN=remote(Tab0, $NV3)::$SAN=$EAN+$TRN+$CON-$VEN::$TCN=$SAN::$EFN=$SAN-$TCN::$EAB=remote(Tab3_2, $EFB)::$FRB=$EFV*remote(Tab0, $BA3);%.0f::$COB=remote(Tab0,$BC3)::$VEB=remote(Tab0,$BV3)::$SAB=$EAB+$FRB+$COB-$VEB::$TCB=$SAB::$EFB=$SAB-$TCB
@ -197,13 +197,13 @@ Comentários sobre a tabela 6
#+NAME: Tab3_4
| | CATEGORIA | EXTTANT | TIR | COMPRA | VENDA | SALDO | TIC | EXTTFIN |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
| # | VACAS >24 | 35 | 11 | 0 | 6 | 40 | 0 | 40 |
| # | VACAS >24 | 20 | 4 | 0 | 0 | 24 | 0 | 24 |
| ^ | | EAV | TRV | COV | VEV | SAV | TCV | EFV |
| # | Novilhas 12<>24 | 0 | 14 | 0 | 0 | 14 | 14 | 0 |
| # | Novilhas 12<>24 | 0 | 5 | 0 | 0 | 5 | 5 | 0 |
| ^ | | EAN | TRN | CON | VEN | SAN | TCN | EFN |
| # | Bezerras <12 | 0 | 16 | 0 | 0 | 16 | 16 | 0 |
| # | Bezerras <12 | 0 | 17 | 0 | 12 | 5 | 5 | 0 |
| ^ | | EAB | FRB | COB | VEB | SAB | TCB | EFB |
| # | outros | 1 | | | | 1 | | 1 |
| # | outros | 1 | | | | | | |
| ^ | | EAO | FRO | COO | VEO | SAO | TCO | EFO |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
#+TBLFM: $EAV=remote(Tab3_3, $EFV)::$TRV=remote(Tab3_3, $TCN)::$COV=remote(Tab0,$VC4)::$VEV=remote(Tab0, $VV4)::$SAV=$EAV+$TRV+$COV-$VEV::$EFV=$SAV::$EAN=remote(Tab3_3, $EFN)::$TRN=remote(Tab3_3, $TCB)::$CON=remote(Tab0,$NC4)::$VEN=remote(Tab0, $NV4)::$SAN=$EAN+$TRN+$CON-$VEN::$TCN=$SAN::$EFN=$SAN-$TCN::$EAB=remote(Tab3_3, $EFB)::$FRB=$EFV*remote(Tab0, $BA4);%.0f::$COB=remote(Tab0,$BC4)::$VEB=remote(Tab0,$BV4)::$SAB=$EAB+$FRB+$COB-$VEB::$TCB=$SAB::$EFB=$SAB-$TCB
@ -219,11 +219,11 @@ Comentários sobre a tabela 6
:END:
| | CATEGORIA | EXTTANT | TIR | COMPRA | VENDA | SALDO | TIC | EXTTFIN |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
| # | VACAS >24 | 40 | 14 | 0 | 14 | 40 | 0 | 40 |
| # | VACAS >24 | 24 | 5 | 0 | 5 | 24 | 0 | 24 |
| ^ | | EAV | TRV | COV | VEV | SAV | TCV | EFV |
| # | Novilhas 12<>24 | 0 | 16 | 0 | 7 | 9 | 9 | 0 |
| # | Novilhas 12<>24 | 0 | 5 | 0 | 0 | 5 | 5 | 0 |
| ^ | | EAN | TRN | CON | VEN | SAN | TCN | EFN |
| # | Bezerras <12 | 0 | 16 | 0 | 0 | 16 | 16 | 0 |
| # | Bezerras <12 | 0 | 17 | 0 | 12 | 5 | 5 | 0 |
| ^ | | EAB | FRB | COB | VEB | SAB | TCB | EFB |
| # | outros | 1 | | | | 1 | | 1 |
| ^ | | EAO | FRO | COO | VEO | SAO | TCO | EFO |
@ -241,13 +241,13 @@ e, finalmente, na tabela 9, a composição do rebanho no sexto ano após a imple
#+caption: Composição do rebanho na fazenda VITRUVIO (ANO 6)
| | CATEGORIA | EXTTANT | TIR | COMPRA | VENDA | SALDO | TIC | EXTTFIN |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
| # | VACAS >24 | 40 | 9 | 0 | 9 | 40 | 0 | 40 |
| # | VACAS >24 | 24 | 5 | 0 | 4 | 25 | 0 | 25 |
| ^ | | EAV | TRV | COV | VEV | SAV | TCV | EFV |
| # | Novilhas 12<>24 | 0 | 16 | 0 | 8 | 8 | 8 | 0 |
| # | Novilhas 12<>24 | 0 | 5 | 0 | 0 | 5 | 5 | 0 |
| ^ | | EAN | TRN | CON | VEN | SAN | TCN | EFN |
| # | Bezerras <12 | 0 | 16 | 0 | 0 | 16 | 16 | 0 |
| # | Bezerras <12 | 0 | 18 | 0 | 14 | 4 | 4 | 0 |
| ^ | | EAB | FRB | COB | VEB | SAB | TCB | EFB |
| # | outros | 1 | | | | 1 | | 1 |
| # | outros | 1 | | | | | | |
| ^ | | EAO | FRO | COO | VEO | SAO | TCO | EFO |
|---+-----------------+---------+-----+--------+-------+-------+-----+---------|
#+TBLFM: $EAV=remote(Tab3_5, $EFV)::$TRV=remote(Tab3_5, $TCN)::$COV=remote(Tab0,$VC6)::$VEV=remote(Tab0, $VV6)::$SAV=$EAV+$TRV+$COV-$VEV::$EFV=$SAV::$EAN=remote(Tab3_5, $EFN)::$TRN=remote(Tab3_5, $TCB)::$CON=remote(Tab0,$NC6)::$VEN=remote(Tab0, $NV6)::$SAN=$EAN+$TRN+$CON-$VEN::$TCN=$SAN::$EFN=$SAN-$TCN::$EAB=remote(Tab3_5, $EFB)::$FRB=$EFV*remote(Tab0, $BA6);%.0f::$COB=remote(Tab0,$BC6)::$VEB=remote(Tab0,$BV6)::$SAB=$EAB+$FRB+$COB-$VEB::$TCB=$SAB::$EFB=$SAB-$TCB
@ -264,16 +264,16 @@ Os dados da tabela abaixo resultam da estimativa de evolução de rebanho, de ac
| | Ano | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 |
|---+--------------------+------+------+------+------+------+------|
| # | Vacas entradas | 0 | 0 | 0 | 0 | 0 | 0 |
| # | Novilhas entradas | 2 | 0 | 0 | 0 | 0 | 0 |
| # | Novilhas entradas | 20 | 0 | 0 | 0 | 0 | 0 |
| # | Terneiras entradas | 0 | 0 | 0 | 0 | 0 | 0 |
|---+--------------------+------+------+------+------+------+------|
| # | Total entradas | 2 | 0 | 0 | 0 | 2 | 0 |
| # | Total entradas | 20 | 0 | 0 | 0 | 20 | 0 |
|---+--------------------+------+------+------+------+------+------|
| # | Vacas saídas | 0 | 0 | 0 | 6 | 14 | 9 |
| # | Novilhas saídas | 0 | 0 | 0 | 0 | 7 | 8 |
| # | Terneiras saídas | 0 | 0 | 0 | 0 | 0 | 0 |
| # | Vacas saídas | 0 | 0 | 0 | 0 | 5 | 4 |
| # | Novilhas saídas | 0 | 0 | 0 | 0 | 0 | 0 |
| # | Terneiras saídas | 0 | 4 | 10 | 12 | 12 | 14 |
|---+--------------------+------+------+------+------+------+------|
| # | Total saídas | 0 | 0 | 0 | 6 | 14 | 17 |
| # | Total saídas | 0 | 4 | 10 | 12 | 17 | 18 |
|---+--------------------+------+------+------+------+------+------|
| | | | | | | | |
#+TBLFM:@2$3=remote(Tab3_1, $COV)::@2$4=remote(Tab3_2, $COV)::@2$5=remote(Tab3_3, $COV)::@2$6=remote(Tab3_4, $COV)::@2$7=remote(Tab3_5, $COV)::@2$8=remote(Tab3_6, $COV)::@3$3=remote(Tab3_1, $CON)::@3$4=remote(Tab3_2, $CON)::@3$5=remote(Tab3_3, $CON)::@3$6=remote(Tab3_4, $CON)::@3$7=remote(Tab3_5, $CON)::@3$8=remote(Tab3_6, $CON)::@4$3=remote(Tab3_1, $COB)::@4$4=remote(Tab3_2, $COB)::@4$5=remote(Tab3_3, $COB)::@4$6=remote(Tab3_4, $COB)::@4$7=remote(Tab3_5, $COB)::@4$8=remote(Tab3_6, $COB)::@5$3=@2$3+@3$3+@4$3::@5$4=@2$4+@3$4+@4$4::@5$5=@2$5+@3$5+@4$5::@5$6=@2$6+@3$6+@4$6::@5$7=@2$7+@3$3+@4$7::@5$8=@2$8+@3$8+@4$8::@6$3=remote(Tab3_1, $VEV)::@6$4=remote(Tab3_2, $VEV)::@6$5=remote(Tab3_3, $VEV)::@6$6=remote(Tab3_4, $VEV)::@6$7=remote(Tab3_5, $VEV)::@6$8=remote(Tab3_6, $VEV)::@7$3=remote(Tab3_1, $VEN)::@7$4=remote(Tab3_2, $VEN)::@7$5=remote(Tab3_3, $VEN)::@7$6=remote(Tab3_4, $VEN)::@7$7=remote(Tab3_5, $VEN)::@7$8=remote(Tab3_6, $VEN)::@8$3=remote(Tab3_1, $VEB)::@8$4=remote(Tab3_2, $VEB)::@8$5=remote(Tab3_3, $VEB)::@8$6=remote(Tab3_4, $VEB)::@8$7=remote(Tab3_5, $VEB)::@8$8=remote(Tab3_6, $VEB)::@9$3=@6$3+@7$3+@8$3::@9$4=@6$4+@7$4+@8$4::@9$5=@6$5+@7$5+@8$5::@9$6=@6$6+@7$6+@8$6::@9$7=@6$7+@7$3+@8$7::@9$8=@6$8+@7$8+@8$8
@ -285,131 +285,55 @@ Os dados da tabela abaixo resultam da estimativa de evolução de rebanho, de ac
:TABLE_EXPORT_FILE: data/Tabela4.csv
:TABLE_EXPORT_FORMAT: orgtbl-to-csv
:END:
| | Ano | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 |
|---+-----------+------+------+------+------+------+------|
| # | Vacas | 20 | 27 | 35 | 40 | 40 | 40 |
| # | Novilhas | 7 | 8 | 11 | 14 | 9 | 8 |
| # | Terneiras | 8 | 11 | 14 | 16 | 16 | 16 |
|---+-----------+------+------+------+------+------+------|
| # | Total | 35 | 46 | 60 | 70 | 63 | 64 |
| # | | | | | | | |
#+TBLFM:@2$3=remote(Tab3_1, $SAV)::@2$4=remote(Tab3_2, $SAV)::@2$5=remote(Tab3_3, $SAV)::@2$6=remote(Tab3_4, $SAV)::@2$7=remote(Tab3_5, $SAV)::@2$8=remote(Tab3_6, $SAV)::@3$3=remote(Tab3_1, $SAN)::@3$4=remote(Tab3_2, $SAN)::@3$5=remote(Tab3_3, $SAN)::@3$6=remote(Tab3_4, $SAN)::@3$7=remote(Tab3_5, $SAN)::@3$8=remote(Tab3_6, $SAN)::@4$3=remote(Tab3_1, $SAB)::@4$4=remote(Tab3_2, $SAB)::@4$5=remote(Tab3_3, $SAB)::@4$6=remote(Tab3_4, $SAB)::@4$7=remote(Tab3_5, $SAB)::@4$8=remote(Tab3_6, $SAB)::@5$3=@2$3+@3$3+@4$3::@5$4=@2$4+@3$4+@4$4::@5$5=@2$5+@3$5+@4$5::@5$6=@2$6+@3$6+@4$6::@5$7=@2$7+@3$3+@4$7::@5$8=@2$8+@3$8+@4$8
| | Categoria | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 |
|---+-----------+------+------+-------+------+------+-------|
| # | Vacas | 0 | 20 | 20 | 24 | 24 | 25 |
| # | Novilhas | 20 | 0 | 4 | 5 | 5 | 5 |
| # | Terneiras | 0 | 4 | 5 | 5 | 5 | 4 |
|---+-----------+------+------+-------+------+------+-------|
| # | T_cab | 20 | 24 | 29 | 34 | 34 | 34 |
| # | T_UGMs | 20. | 21. | 25.25 | 30.5 | 31.5 | 31.75 |
| # | | | | | | | |
#+TBLFM:@2$3=remote(Tab3_1, $SAV)::@2$4=remote(Tab3_2, $SAV)::@2$5=remote(Tab3_3, $SAV)::@2$6=remote(Tab3_4, $SAV)::@2$7=remote(Tab3_5, $SAV)::@2$8=remote(Tab3_6, $SAV)::@3$3=remote(Tab3_1, $SAN)::@3$4=remote(Tab3_2, $SAN)::@3$5=remote(Tab3_3, $SAN)::@3$6=remote(Tab3_4, $SAN)::@3$7=remote(Tab3_5, $SAN)::@3$8=remote(Tab3_6, $SAN)::@4$3=remote(Tab3_1, $SAB)::@4$4=remote(Tab3_2, $SAB)::@4$5=remote(Tab3_3, $SAB)::@4$6=remote(Tab3_4, $SAB)::@4$7=remote(Tab3_5, $SAB)::@4$8=remote(Tab3_6, $SAB)::@5$3=@2$3+@3$3+@4$3::@5$4=@2$4+@3$4+@4$4::@5$5=@2$5+@3$5+@4$5::@5$6=@2$6+@3$6+@4$6:: @5$7=@2$7+@3$7+@4$7::
@5$8=@2$8+@3$8+@4$8::@6$3=(@2$3*remote(Tab1,@2$2)+@3$3*remote(tab1,@3$2)+@4$3*remote(tab1,@4$2))::@6$4=(@2$4*remote(Tab1,@2$2)+@3$4*remote(tab1,@3$2)+@4$4*remote(tab1,@4$2))::@6$5=(@2$5*remote(Tab1,@2$2)+@3$5*remote(tab1,@3$2)+@4$5*remote(tab1,@4$2))::@6$6=(@2$6*remote(Tab1,@2$2)+@3$6*remote(tab1,@3$2)+@4$6*remote(tab1,@4$2))::@6$7=(@2$7*remote(Tab1,@2$2)+@3$7*remote(tab1,@3$2)+@4$7*remote(tab1,@4$2))::@6$8=(@2$8*remote(Tab1,@2$2)+@3$8*remote(tab1,@3$2)+@4$8*remote(tab1,@4$2))
* TODO Resolver exportar ou criar data.tabela. Para continuar, é necessário exportar a Tabela acima. Faço pelo menu Table - Export to file. Nome do Arquivo a exportar = Tabela$.csv.>>
*** Importação dos dados dos animais existentes
#+begin_src R
library (data.table)
library(tidyr)
library(dplyr)
library (ggplot2)
#+end_src
#+RESULTS:
** Gráfico resumo
#+NAME: Ler data.table Resumo
#+begin_src R
Evol_exist <- fread("data/Tabela4.csv", check.names =FALSE, header=TRUE)
str(Evol_exist)
#Transpor a tabela
Evol_exist1<-dcast(melt(Evol_exist, id.vars="Ano"),variable ~Ano)
# deu um trabalho para n ão aparecer uma linha nova com os nomes da colunas...
str(Evol_exist1)
Evoluc<-Evol_exist1%>%
pivot_longer(!variable, names_to="Categoria", values_to="Cabecas")%>%
dplyr::mutate(Ano=variable)
#View(Evoluc)
str(Evoluc)
#+end_src
library(data.table)
library(tidyr)
library(dplyr)
REV<-fread("~/Documentos/GITs/Compos_rebanho/data/ResumoEvolucaoVitruvio.csv", header=TRUE)
REv<- REV%>%
pivot_longer (cols=c("2004", "2005", "2006", "2007", "2008", "2009"),
names_to="Ano",
values_to="Quantidade",
values_drop_na = TRUE )
#+RESULTS:
#+begin_example
Classes data.table and 'data.frame': 5 obs. of 7 variables:
$ Ano : chr "Vacas" "Novilhas" "Terneiras" "Total" ...
$ 2004: int 20 7 8 35 NA
$ 2005: int 27 8 11 46 NA
$ 2006: int 35 11 14 60 NA
$ 2007: int 40 14 16 70 NA
$ 2008: int 40 9 16 63 NA
$ 2009: int 40 8 16 64 NA
- attr(*, ".internal.selfref")=<externalptr>
Classes data.table and 'data.frame': 6 obs. of 6 variables:
$ variable : Factor w/ 6 levels "2004","2005",..: 1 2 3 4 5 6
$ V1 : int NA NA NA NA NA NA
$ Novilhas : int 7 8 11 14 9 8
$ Terneiras: int 8 11 14 16 16 16
$ Total : int 35 46 60 70 63 64
$ Vacas : int 20 27 35 40 40 40
- attr(*, ".internal.selfref")=<externalptr>
- attr(*, "sorted")= chr "variable"
tibble [30 × 4] (S3: tbl_df/tbl/data.frame)
$ variable : Factor w/ 6 levels "2004","2005",..: 1 1 1 1 1 2 2 2 2 2 ...
$ Categoria: chr [1:30] "V1" "Novilhas" "Terneiras" "Total" ...
$ Cabecas : int [1:30] NA 7 8 35 20 NA 8 11 46 27 ...
$ Ano : Factor w/ 6 levels "2004","2005",..: 1 1 1 1 1 2 2 2 2 2 ...
#+end_example
REv$Ano=as.numeric(REv$Ano)
View(REv)
#end_src
#+NAME: grafico resumo
#+begin_src R
library (ggplot2)
*** Gráfico da evolução do rebanho
test1<-ggplot(REv, aes(Ano,
Quantidade,
colour=Categoria))+
geom_line()
test1
#+end_src
** Gráfico 1
#+header: :width 8 :height 8 :family Times
#+begin_src R :file ..fig/evol1.png :results file graphics
Evoluc<-ggplot(Evoluc, aes(x=Ano, y=Cabecas, group = Categoria))+
geom_line (aes(color=Categoria))+
geom_point(aes(color=Categoria))
getwd()
png(filename="fig/Evoluc1.png")
plot(Evoluc)
Evoluc
#+end_src
#+RESULTS:
[[file:~/fig/Evoluc11.png]]
#+RESULTS: Ler data.table Resumo
: tibble [36 × 3] (S3: tbl_df/tbl/data.frame)
: $ Categoria : chr [1:36] "Vacas" "Vacas" "Vacas" "Vacas" ...
: $ Ano : num [1:36] 2004 2005 2006 2007 2008 ...
: $ Quantidade: num [1:36] 0 20 20 24 24 25 20 0 4 5 ...
: Warning message:
: Removed 6 rows containing missing values
: (`geom_line()`).
**
* TODO - Resolver exportação figura no arquivo html
** Animais vendidos
| # | Vacas vendidas | | | | | | | | | | | | | | | |
| # | Novilhas vendidas | | | | | | | | | | | | | | | |
| # | Terneiras vendidas | | | | | | | | | | | | | | |
* Figuras (só para testar)
Exemplo 2
#+caption:Vacas com água, pasto e sombra.
#+ATTR_HTML:width 300 px :align center :title Action!
[[https://nuvem.multifarm.top/apps/files/?dir=/Photos&openfile=457851]]
Exemplo 3 -
#+begin_export html
<div id="subtittle" style="float: center; text-aling:center;">
<p>
<font size="1"> Composição do rebanho. Nes propriedade, os animais são divididos em dois lotes para o pastoreio.</font>
</p>
<p>
<a href="http://multifarm.top">
<img src= "[[https://nuvem.multifarm.top/apps/files/?dir=/Photos&openfile=457848]]" width = "250"/>
</a>
</p>
</div>
#+end_export>
#+Caption: Composição do rebanho. Nes propriedade, os animais são divididos em dois lotes para o pastoreio.
#+ATTR_HTML: width 200 px :aling center
[[https://nuvem.multifarm.top/apps/files/?dir=/Photos&openfile=457848]]

View File

@ -0,0 +1,7 @@
Categoria,2004,2005,2006,2007,2008,2009
Vacas,0,20,20,24,24,25
Novilhas,20,0,4,5,5,5
Terneiras,0,4,5,5,5,4
T_cab,20,24,29,34,34,34
T_UGMs,20.,21.,25.25,30.5,31.5,31.75
,,,,,,
1 Categoria 2004 2005 2006 2007 2008 2009
2 Vacas 0 20 20 24 24 25
3 Novilhas 20 0 4 5 5 5
4 Terneiras 0 4 5 5 5 4
5 T_cab 20 24 29 34 34 34
6 T_UGMs 20. 21. 25.25 30.5 31.5 31.75
7

View File

@ -0,0 +1,7 @@
Categ,2004,2005,2006,2007,2008,2009
Vacas,0,20,20,24,24,25
Novilhas,20,0,4,5,5,5
Terneiras,0,4,5,5,5,4
T_cab,20,24,29,34,34,34
T_UGMs,20.,21.,25.25,30.5,31.5,31.75
,,,,,,

10
data/Tabela3.csv Normal file
View File

@ -0,0 +1,10 @@
Ano,2004,2005,2006,2007,2008,2009
Vacas entradas,0,0,0,0,0,0
Novilhas entradas,2,0,0,0,0,0
Terneiras entradas,0,0,0,0,0,0
Total entradas,2,0,0,0,2,0
Vacas saídas,0,0,0,3,14,9
Novilhas saídas,0,0,0,0,7,8
Terneiras saídas,0,0,0,0,0,0
Total saídas,0,0,0,3,14,17
,,,,,,
1 Ano 2004 2005 2006 2007 2008 2009
2 Vacas entradas 0 0 0 0 0 0
3 Novilhas entradas 2 0 0 0 0 0
4 Terneiras entradas 0 0 0 0 0 0
5 Total entradas 2 0 0 0 2 0
6 Vacas saídas 0 0 0 3 14 9
7 Novilhas saídas 0 0 0 0 7 8
8 Terneiras saídas 0 0 0 0 0 0
9 Total saídas 0 0 0 3 14 17
10

BIN
fig/Evoluc1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB