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

Parse_date Time Zone Linking Issue #16

Closed
zzaidi148 opened this issue Feb 8, 2021 · 11 comments
Closed

Parse_date Time Zone Linking Issue #16

zzaidi148 opened this issue Feb 8, 2021 · 11 comments

Comments

@zzaidi148
Copy link

Hello

So I was reading through the rethomics documentation and playing with the toy data but was unable to link the metadata and data files because of a failure related to parse_date:
`> metadata <- link_ethoscope_metadata(metadata,

  •                                 result_dir = "ethoscope_results")
    

Error in parse_date(date, tz = "UTC") : Unexpected type for x`
Is there any way to resolve the tz issue?

Thank you very much in advance!

@LeonieCK
Copy link

LeonieCK commented Mar 9, 2021

I had a similar problem, it seemed to be because the date column in the metadata.csv file had been formatted to a slash version e.g. 07/07/2020. You need to reformat those cells into the write format, e.g. 2020-07-07.

@LeonieCK
Copy link

LeonieCK commented Mar 9, 2021

Actually this still doesnt seem to work for me, if you figured out the answer please let me know!

@antortjim
Copy link

antortjim commented Mar 9, 2021

This is an issue that started happening with some update in either R or some of the packages used by rethomics.
The solution is commented here
gilestrolab/ethoscope#146 (comment)

You need to make sure:

  1. the date is formatted as follows (YYYY-MM-DD)
  2. the date is read into R as a character -> class(metadata$date) must return character
  1. is confirmed by opening the metadata.csv file with a text editor like Notepad++ in Windows or Gedit in Ubuntu or Linux. You can also open it in a Linux terminal with less cat, etc.
    This issue is very confusing because Excel, Google Sheets and friends format the date for you behind the scenes, so the actual format stored in the file does not match what you see on the GUI. In Google Sheets, this automatic formatting is disabled by going to Format > Number > Plain text.
  2. If 2 is not true, then make sure it is a character by running metadata$date <- as.character(metadata$date)

@LeonieCK
Copy link

LeonieCK commented Mar 9, 2021

Thanks very much for the quick reply @antorjim, your solution helped me a lot!

@ggilestro
Copy link

Hi @qgeissmann -
I can confirm this is an issue with datatable 1.14.2
It's probably best to fix this directly in rethomics with a sanity check here

I reckon this should do it:

out[, date := as.character(date)]

@ggilestro ggilestro reopened this Dec 15, 2021
@qgeissmann
Copy link
Contributor

Should be on its way to CRAN. Hopefully, the patch solves the main issue

@ggilestro
Copy link

Hi Quentin,

I am afraid this either never made it to CRAN or it was not fixed properly because we still experience the bug whenever date is not a character

metadata_table <- fread(METADATA)
class(metadata_table$date)

If this returns 'IDate''Date' then the link process will fail

@ggilestro ggilestro reopened this Jul 19, 2022
@qgeissmann
Copy link
Contributor

thanks for picking that up. I will try to have a look ASAP... Do you manage to get it working with the github version of the package?

library(devtools)
install_github("rethomics/scopr")

@ggilestro
Copy link

Just tried. Yes, it does work fine with the github version.

@qgeissmann
Copy link
Contributor

ok. great. I just never sent the confirmation form from CRAN I think. just did that now. That could take a few days to review the package etc, but hopefully should get in soon. Thanks for the reminder!

@qgeissmann
Copy link
Contributor

Dear maintainer,
 
thanks, package scopr_0.3.4.tar.gz is on its way to CRAN.
 
Best regards,
CRAN teams' auto-check service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants