Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELISAQC R markdown report not reporting time of test #9

Open
AmyMikhail opened this issue Mar 6, 2021 · 3 comments
Open

ELISAQC R markdown report not reporting time of test #9

AmyMikhail opened this issue Mar 6, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@AmyMikhail
Copy link
Collaborator

Problem statement:

The R markdown report should import the date and time the ELISA test was performed from the header information in the raw ELISA results file. Currently this is not working and just produces NA.

Proposed solution:

The Biotek 800TS Gen5 software that produces the raw ELISA results file is American, therefore uses the 12 hour clock. Posixct formatting in the r code is expecting a 24 hour clock format:

elisa_timestamp <- as.POSIXlt.character(elisa_timestamp, format = "%d/%m/%Y %H:%M")

Change this to a 12 hour clock format including the AM or PM designation:

elisa_timestamp <- as.POSIXlt.character(elisa_timestamp, format = "%d/%m/%Y %I:%M %p")
@AmyMikhail AmyMikhail added the bug Something isn't working label Mar 6, 2021
@AmyMikhail AmyMikhail self-assigned this Mar 6, 2021
@AmyMikhail
Copy link
Collaborator Author

Checked this and it seems not the issue...

  • if the .csv is opened as a text file, time is displayed as 12 hour clock
  • if the .csv is opened in Microsoft Excel (without saving), time is displayed as 24 hour clock but only the date is imported.
  • if the .csv is opened in Microsoft Excel and the file is saved, time is displayed and imported to r as 24 hour clock.

To be investigated further.

@PaulC91
Copy link
Collaborator

PaulC91 commented Mar 9, 2021

Hi Amy.

I'm not sure if I've understood completely but you could try importing as text initially then use lubridate::parse_date_time, passing various datetime formats to the orders argument. It will go through the list of formats in the order you provide them and attempt to parse the datetime. Useful if you are not sure exactly what the format might be when importing.

lubridate::parse_date_time(
  c("7/03/2021 9:30 AM", "7/03/2021 14:30", "7/03/2021 10:30 PM", "7/03/2021 11:30"), 
  orders = c("%d/%m/%Y %H:%M", "%d/%m/%Y %I:%M %p"),
)
#> [1] "2021-03-07 09:30:00 UTC" "2021-03-07 14:30:00 UTC"
#> [3] "2021-03-07 22:30:00 UTC" "2021-03-07 11:30:00 UTC"

Created on 2021-03-09 by the reprex package (v1.0.0)

@AmyMikhail
Copy link
Collaborator Author

@PaulC91 it seems to be something strange with my windows 10 locale - when I open .csv files in Microsoft Excel I have to use text to columns to convert them - I didn´t have to do this with .csv files in windows 7. The timestamp now appears in the .Rmd report but not in the relevant column of the output results file unless I open the .csv in Microsoft Excel first and save it.

Not quite sure what is going on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants