-1

Screenshot of console

I ran the first two lines of code in the screenshot and got one result. When I ran the same code today (the last two lines of code), I got a different result.

I expected to get the same result, but got a different one. Am I doing something wrong that I could not notice?

1 Answers1

2

The documentation for the %V format specifier says

(Accepted but ignored on input.)

What this means is that you can specify %V when formatting dates; but when parsing (i.e. reading) a date from a string, this format specifier is simply ignored. The result is thus the same as if you had written:

as.Date('2009', '%Y')

In which case the function fills in the missing components of the date (i.e. the month and day) from the current date, which obviously changes from day to day.

In other words: parsing a date expressed in terms of the week number is not supported by this function.

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214