0

I am attempting to load a txt-file into RStudio using zoo time series. When doing so I get the following error:

"invalid multibyte string 109",

when loading in as follows:

library(zoo)

funds = read.zoo("funddata.txt", header=TRUE)

Does anyone know why I get this particular error-code?

Phil
  • 7,287
  • 3
  • 36
  • 66
Nick
  • 37
  • 6
  • From https://stackoverflow.com/questions/14363085/invalid-multibyte-string-in-read-csv?rq=1, maybe you could try `funds = read.zoo("funddata.txt", header=TRUE, encoding="UTF-8")` – Ramiro Magno Apr 27 '20 at 08:09
  • What exactly is in this input file? Are you sure it's a plain text file? Do you know the encoding? What OS are you on? Where did the file come from? – MrFlick Apr 27 '20 at 08:15
  • @rmagno Thank you for responding to my question! Using your code suggestion made no difference to the error-code. – Nick Apr 27 '20 at 08:20
  • @MrFlick Thank you for responding to my question! The input file contains mutual fund data of a 106 funds from 1983 til 2019. It is nothing suggesting that it is anything other than a plain text file. MacOS Catalina. The file is constructed from a website making fund data (professionals). – Nick Apr 27 '20 at 08:23
  • 2
    This looked to be have working: ```` funds = read.zoo("funddata.txt", header=TRUE, fileEncoding="latin1") ```` Thanks @rmagno for the link. – Nick Apr 27 '20 at 09:35

0 Answers0