0
mydata <- read.csv("C:/Users/rs1a17/Desktop/mydata.csv")

plotTimingPatterns(mydata,n=30,T.cal="2004-01-01",headers = c("Past", "Future"), title = "")

Error in gmin(date) : min is not meaningful for factors.

How to solve this question?


my data is like this:

   cust       date
2000015 1993-11-05 
2000015 1993-11-25 
2000015 1994-12-06 
2000015 1997-10-01 

and I write

mydata$date<-as.character(mydata$date)

Then

plotTimingPatterns(mydata,n=30,T.cal="2004-01-01",headers = c("Past", "Future"), title = "")
user20650
  • 24,654
  • 5
  • 56
  • 91
Ruixue Sun
  • 11
  • 1
  • 3
    Convert your date column to a `Date` class so it's not a factor. See `?Date`, or search Stack Overflow for "[r] convert date". – Gregor Thomas Jul 25 '18 at 18:24
  • Thanks a lot, while I think my date is in right format, so I do not know how to convert it. – Ruixue Sun Jul 25 '18 at 18:31
  • 1
    Right. So did you look at the help page `?Date` or search stack overflow for "[r] convert data"? Those are both good ways to learn how to convert it. Since you haven't shared any reproducible example data (I don't have `mydata.csv` on my desktop), the best I can do is point you to good resources. If you want code in an answer, you should (a) show what you've tried, and (b) share a reproducible example. [Here's a great walkthrough of how to make reproducible examples](https://stackoverflow.com/q/5963269/903061) if you need help with that. – Gregor Thomas Jul 25 '18 at 18:46
  • sorry, I am the new learner of R and my data is like this: cust date 2000015 1993-11-05 2000015 1993-11-25 2000015 1994-12-06 2000015 1997-10-01 and I write "mydata$date<-as.character(mydata$date)" Then "plotTimingPatterns(mydata,n=30,T.cal="2004-01-01",headers = c("Past", "Future"), title = "")" – Ruixue Sun Jul 25 '18 at 18:48
  • @RuixueSun ; you're almost there, but instead of coercing to `character` class you likely need to change it to `Date` class - see `?as.Date` ps if `plotTimingPatterns` is from a package can you add these details please – user20650 Jul 25 '18 at 19:41
  • Thanks so much for your help, I manage to do it. – Ruixue Sun Jul 28 '18 at 15:52

0 Answers0