Different results for same date string using lubridate package in R

Bamqf

I have a vector of strings:

str <- c("01-", "01-just researching", "01-1-3 months", "01-immediately", "01-4-6 months", "01-more than 12 months", "01-7-12 months")

If I parse it using parse_date_time from lubridate package, it would get different result if I only parse the first 6 strings. Why?

parse_date_time(str, "dmy")
[1] NA               NA               "2003-01-01 UTC" NA               "2006-04-01 UTC"
[6] NA               "2012-07-01 UTC"

parse_date_time(str[1:6], "dmy")
[1] NA NA NA NA NA NA
bergant

There is a function guess_formats which is so kind to explain which elements match the template. As you can see only the last string does:

guess_formats(str, "dmy", print_matches = TRUE)

#                               dmy              
# [1,] "01-"                    ""               
# [2,] "01-just researching"    ""               
# [3,] "01-1-3 months"          ""               
# [4,] "01-immediately"         ""               
# [5,] "01-4-6 months"          ""               
# [6,] "01-more than 12 months" ""               
# [7,] "01-7-12 months"         "%d-%m-%y months"

I think the rest is obvious.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Different results for same date string using lubridate package in R

From Dev

Determine season from Date using lubridate in R

From Dev

SimpleDateFormat parse and format on same date string gives different results

From Dev

Different results, using same data and method(?), when using WordMat and R

From Dev

Different results using the same maths in different browsers

From Dev

QCryptographicsHash gives different results for same string

From Dev

Unexpected different results from the same String input

From Dev

Two different print results with same string

From Dev

Different assert results from "same" string

From Dev

Python - help() command - same string different results

From Dev

nslookup different results using same dns server?

From Dev

Trying to find the same string in a text file using Python returns two different results

From Dev

R writing time intervals using lubridate package in an Excel file using XLConnect

From Dev

Same Python code returns different results for same input string

From Dev

Digging into R package: Time Zones in lubridate

From Dev

Find day of year with the lubridate package in R

From Dev

Display time in hrs and minutes format using lubridate package in R : Dataframe Issue

From Dev

aggregating with lubridate back to normal date in R

From Dev

How to create date from datetime (using lubridate)?

From Dev

How to determine if date is a weekend or not (not using lubridate)

From Dev

different results for standard deviation using numpy and R

From Dev

different results using R in windows and linux

From Dev

Why do I get different results in plotting a NetCDF layer with "image(x,y,z)" and "plot (raster)" using R-package Raster?

From Dev

Shifting string with control shift input, same logic but different results

From Dev

Different results for date() and gmdate()

From Dev

The same XPaths - different results

From Dev

Different results for same numbers

From Dev

The same XPaths - different results

From Java

Error when using the same string in different tests

Related Related

  1. 1

    Different results for same date string using lubridate package in R

  2. 2

    Determine season from Date using lubridate in R

  3. 3

    SimpleDateFormat parse and format on same date string gives different results

  4. 4

    Different results, using same data and method(?), when using WordMat and R

  5. 5

    Different results using the same maths in different browsers

  6. 6

    QCryptographicsHash gives different results for same string

  7. 7

    Unexpected different results from the same String input

  8. 8

    Two different print results with same string

  9. 9

    Different assert results from "same" string

  10. 10

    Python - help() command - same string different results

  11. 11

    nslookup different results using same dns server?

  12. 12

    Trying to find the same string in a text file using Python returns two different results

  13. 13

    R writing time intervals using lubridate package in an Excel file using XLConnect

  14. 14

    Same Python code returns different results for same input string

  15. 15

    Digging into R package: Time Zones in lubridate

  16. 16

    Find day of year with the lubridate package in R

  17. 17

    Display time in hrs and minutes format using lubridate package in R : Dataframe Issue

  18. 18

    aggregating with lubridate back to normal date in R

  19. 19

    How to create date from datetime (using lubridate)?

  20. 20

    How to determine if date is a weekend or not (not using lubridate)

  21. 21

    different results for standard deviation using numpy and R

  22. 22

    different results using R in windows and linux

  23. 23

    Why do I get different results in plotting a NetCDF layer with "image(x,y,z)" and "plot (raster)" using R-package Raster?

  24. 24

    Shifting string with control shift input, same logic but different results

  25. 25

    Different results for date() and gmdate()

  26. 26

    The same XPaths - different results

  27. 27

    Different results for same numbers

  28. 28

    The same XPaths - different results

  29. 29

    Error when using the same string in different tests

HotTag

Archive