When trying to read a local csv file im getting the error
Error in xts(dat, order.by = as.Date(rownames(dat), "%m/%d/%Y")) : 'order.by' cannot contain 'NA', 'NaN', or 'Inf'
im trying out the example from https://rpubs.com/mohammadshadan/288218 which is the following:
tmp_file <- "test.csv"
# Create dat by reading tmp_file
dat <- read.csv(tmp_file,header=FALSE)
# Convert dat into xts
xts(dat, order.by = as.Date(rownames(dat), "%m/%d/%Y"))
# Read tmp_file using read.zoo
dat_zoo <- read.zoo(tmp_file, index.column = 0, sep = ",", format = "%m/%d/%Y")
# Convert dat_zoo to xts
dat_xts <- as.xts(dat_zoo)
the thing is when i try to read the file like in the example which is reading the file from the server this works somehow but not when i try with a csv file locally even if its the same info as the file in the web.
i have tried creating the csv file with Notepad,Notepad++ and Excel with no luck. Any idea what im missing?, i have also tried using read.table instead of csv with the same results...
File can be found at: https://ufile.io/zfqje
if header=TRUE i get the following error:
Warning messages: 1: In read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'test.csv' 2: In read(file, ...) : incomplete final line found by readTableHeader on 'test.csv'
dat_xts a b 2015-01-02 1 3 2015-02-03 2
– MKR