27 lines
716 B
R
27 lines
716 B
R
|
|
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
|