write_alerta: Write historico_alerta into the database.

View source: R/alert_functions.R

write_alertaR Documentation

Write historico_alerta into the database.

Description

Function to write the pipeline results into the database. Receives the object created by the function historico.alerta. If writetofile == TRUE, it saves the sql command in a text file. If FALSE, it will write directly in the database using the connection.

Usage

write_alerta(d, writetofile = FALSE, datasource = con, arq = "output.sql")

Arguments

d

object created by tabela_historico()

writetofile

TRUE if an sql object will be the output; FALSE if not.

datasource

posgreSQL conn to project's database

arq

file name to store sql object

Value

the same data.frame from the input

Examples

# Parameters for the model 
cidades <- getCidades(regional = "Norte",uf = "Rio de Janeiro",datasource = con)
res <- pipe_infodengue(cities = cidades$municipio_geocodigo[1], cid10 = "A90", 
datarelatorio = 202407, iniSE = 202301, nowcasting="none")
restab <- tabela_historico(res)
res2 <- pipe_infodengue(cities = cidades$municipio_geocodigo[1], cid10 = "A90", 
datarelatorio = 202406, iniSE = 202301, nowcasting="none")
restab2 <- tabela_historico(res2)
# NOT RUN 
t1 <- Sys.time()
write_alerta(restab[1:10,], writetofile = TRUE)
t2 <- Sys.time() - t1

AlertaDengue/AlertTools documentation built on Nov. 27, 2024, 11:55 p.m.