ERROR NA, NaN, or Inf when using XTS function

Hi Everyone

I have this problem with my Rstudio only, but whem i use jupyter notebook with R kernel the codes works properly:


Suppres Package Warning

quietly <- suppressPackageStartupMessages

Disable scientific notation

options(scipen = 9999)

Change chart dimension

options(repr.plot.width=12, repr.plot.height=7)

Load package suppress warning

quietly(library(xts))
quietly(library(tidyverse))
quietly(library(lubridate))
quietly(library(forecast))

Read the kraken_clean.csv file a kraken_df

kraken_df = read_csv("data/kraken_clean.csv")

Inspect the first few rows of the DataFrame

head(kraken_df)

Subset a DataFrame of XBT crypto

xbt_df = kraken_df[kraken_df$crypto == "XBT",]

xbt_xts = xts(select(xbt_df,-c("crypto","datetime","date","time")),
order.by = as.POSIXct(strptime(xbt_df$date,"%Y-%m-%d")))

ERROR:

"Error in xts(select(xbt_df, -c("crypto", "datetime", "date", "time")), : 'order.by' cannot contain 'NA', 'NaN', or 'Inf'"

The data doesn't have NA's values.

I don't know if my problem come from the packages and libraries or I just need more one step.

The objective is to transform the raw data of the csv to a data frame and then a time series data to be use in statistical analysis.

Ty for your time

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.