ipeaGIT / flightsbr

R Package to Download Flight and Airport Data from Brazil
https://ipeagit.github.io/flightsbr/
Other
41 stars 6 forks source link

Trouble selecting variables #28

Closed baarthur closed 1 year ago

baarthur commented 1 year ago

Hi there,

First of all, thanks for the great work on this package! I am not sure if this is a bug or more of a feature request, but here it goes:

When selecting variables in read_flights(), I can't select columns "sg_equipamento_icao" and "ds_matricula", which are available on Anac's data according to the link in the function's manual. I think there may be a bug while fetching those columns... Or they aren't available in the package's dataset?

In addition: it would be great if we could pass a vector of dates in the function!

Here's my code:

df_flights <- read_flights(
  202303, 
  type = "combinada", 
  select = c(
    "id_combinada", 
    "sg_empresa_icao", "nr_voo", "dt_referencia", 
    "sg_icao_origem", "sg_icao_destino", 
    "ds_natureza_etapa", "nr_etapa", "cd_di", "ds_di", 
    "dt_partida_real", "dt_chegada_real", 
    "sg_equipamento_icao", "ds_matricula", # these two throw a warning message
    "nr_passag_pagos", "nr_passag_gratis", 
    "kg_bagagem_livre", "kg_bagagem_excesso", "kg_carga_paga", "kg_carga_gratis", "kg_correio"
  )
) %>% 
  mutate(
    across(
      nr_passag_pagos:kg_correio,
      as.numeric
    )
  )
rafapereirabr commented 1 year ago

For some reason, the columns sg_equipamento_icao and ds_matricula are present in the "basica data set data (type = "basica") but not in the "combinada" data set. I don't know why, but this is something in the original ANAC data, so there's nothing we can do on our side unfortunately.

Regarding your suggestion, that's a very good suggestion. I've opened a We should probably open a separate for it.