time series problems


No cake for spunky
I do
mydata <- read_excel(file.choose())

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

I do
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.


Less is more. Stay pure. Stay poor.
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.


No cake for spunky
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.


Ambassador to the humans
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.