time series problems

noetsi

No cake for spunky
#1
I do
Code:
mydata <- read_excel(file.choose())

 mydata<- ts(mydata$Spend, start = c(2017, 7), frequency = 12)
and I have no trouble

I do
Code:
mydatatr<- ts(mydata$Spend, start = c(2017, 7), end = c(2021,9), frequency = 12)
and I get
Error in mydata$Spend : $ operator is invalid for atomic vectors

It is the same data set, this makes no sense.
 

hlsmith

Less is more. Stay pure. Stay poor.
#2
Does ts have source documentation to help inform you? It has been a long time since I got an atomic error, but isn't that usually an error that says the variable has to come from a single vector data source. Trying to remember if it requires a reformatting or not.
 

noetsi

No cake for spunky
#3
It is an error about the formatting of the data. What does not make sense here is it gives no error for the whole data set, but gives an error when you use part of the data set. It's the same data set.
 

Dason

Ambassador to the humans
#4
Can you show full sessions with input and the output. No offense but you're notoriously bad at describing what actually occurred.

So start a fresh R session and show what worked. Then start a new fresh R session and show the thing that didn't work.