How to ignore the NA values in a dataframe running auto.

Asked

Viewed 177 times

0

I have the code to run the auto.It runs on a small dataframe, but in some columns I have several 'NA' values (from 1990 to 2003, for example). How to establish in my code that such values are ignored? >

bra.ts <- ts(CSV_BRA, frequency = 1, start = c(1990), end = c(2016))

taxa <- ts(BRA$TX_CS, frequency = 1, start = c(1990), end = c(2016))
# Comando para indicar a regressão

covariates <- c('RURAL', 'AMZ', 'N', "VALUE_N", 'AREA')

fit<- auto.arima(bra.ts[,"TX_CS"], xreg = bra.ts[,covariates], stepwise = FALSE, 
                 approximation = FALSE)
fit

DATAFRAME

https://drive.google.com/file/d/14YjSAAHul9YrBDfs1FoE50mNfA7ftHD6/view?usp=sharing

  • 4

    The function na.omit(dataframe) shall omit those observations.

  • 2

    Please edit the question with the output of dput(head(CSV_BRA, 5)). Data such as images cannot be used by those who want to help, cannot be copied to an R session.

  • 1

    Another way is bra.ts2 <- bra.ts[complete.cases(bra.ts), ].

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.