0

I tried to enter these commands but it does not work... can someone help please?

OPts <- read.csv(OILBRENT)

Error in read.table(file = file, header = header, sep = sep, quote = quote, : 'file' must be a character string or connection

OPts <- ts(OILBRENT, start = c(jun-87), end = c(Jan-20), frequency =12)

Error in ts(OILBRENT, start = c(jun - 87), end = c(Jan - 20), frequency = 12) : object 'jun' not found

OPts <- ts(OILBRENT, start = c(jun-87, 1), end = c(Dec-19, 12), frequency =12)

Error in ts(OILBRENT, start = c(jun - 87, 1), end = c(Dec - 19, 12), frequency = 12) : object 'jun' not found

massisenergy
  • 1,764
  • 3
  • 14
  • 25
Jan
  • 1
  • Please take a look at [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), to modify your question, with a smaller sample taken from your data (check `?dput()`). Posting images of your data or no data makes it difficult to impossible for us to help you! – massisenergy Mar 01 '20 at 11:39
  • What is `U`? do not use slang here. – fcm Mar 01 '20 at 11:40
  • @fcm U is the letter next to I. Given the sentence it's likely a typo... – rg255 Mar 01 '20 at 11:46
  • First, U need to import the data successfully. Once that task has been accomplished, you need to find Jun. – Edward Mar 01 '20 at 12:14

1 Answers1

0

seems you are missing some quotation marks.

read.csv expects either a character pointing to a file, or a connection. If you are trying to read a file in your current working directory try OPts <- read.csv("OILBRENT").

Both ts commands seem to be failing because the start parameter is expecting either a number or a numeric vector. When you write start = c(jun-87), R will try to find an object jun and then compute the difference jun - 87. From the man page for ts:

  start: the time of the first observation.  Either a single number or
          a vector of two integers, which specify a natural time unit
          and a (1-based) number of samples into the time unit.  See
          the examples for the use of the second form.
Coy
  • 329
  • 1
  • 7