[R] doubt clarification

Duncan Murdoch murdoch.duncan at gmail.com
Tue Mar 15 19:29:09 CET 2016

On 15/03/2016 12:53 PM, MEHER DIVYA BARATAM wrote:
> dear sir/madam,
>                          i am a new learner of r software. while plotting a
> graph of data which contains date. i have dates on X-axis, while learning i
> got to know i have to convert into R understandable language. i got an
> error while converting
> "as.Date(all.2015$Day,%d-%m-%y)
>    Error: unexpected SPECIAL in "as.Date(all.2015$Day,%d-%"

You need to put the format in quotes.  R sees %d-% as a "SPECIAL" 
operator, and it is an error for one of those to appear in that position.

So use

as.Date(all.2015$Day, "%d-%m-%y")

(and be careful of the quotes:  these are regular ASCII quotes, not directional quotes which some editors will insert).

Duncan Murdoch

More information about the R-help mailing list