rethomics / damr

Read TriKinetics' DAM data in R
http://rethomics.github.io
6 stars 6 forks source link

Again "Error in find_dam_first_last_lines(path, start_datetime, stop_datetime"... #26

Closed pericles-pendragon closed 4 years ago

pericles-pendragon commented 4 years ago

Hello. If anyone can help... I readed all issues with the same problem "Error in find_dam_first_last_lines(path, start_datetime, stop_datetime, : No data in selected date range" I changed the languaje to English US (someone find a solution in this way), I work in Ubuntu 18.04, only using the default text editor for make metadata. Is there another solution. The R path was:

DATA_DIR <- "/home/pendragon/Documents/Sueño-Trick/Mediciones_2019-11-22" list.files(DATA_DIR, pattern= ".txt|.csv") [1] "metadata.csv" "Monitor15.txt" "Monitor19.txt" setwd(DATA_DIR) library(damr) Loading required package: behavr Loading required package: data.table data.table 1.12.8 using 2 threads (see ?getDTthreads). Latest news: r-datatable.com metadata <- fread("metadata.csv") metadata file start_datetime stop_datetime region_id sex condition 1: Monitor15.txt 2019-11-17 2019-11-22 1 F NN 2: Monitor15.txt 2019-11-17 2019-11-22 2 F NN 3: Monitor15.txt 2019-11-17 2019-11-22 3 F NN 4: Monitor15.txt 2019-11-17 2019-11-22 4 F NN 5: Monitor15.txt 2019-11-17 2019-11-22 5 F NN 6: Monitor15.txt 2019-11-17 2019-11-22 6 F NN 7: Monitor15.txt 2019-11-17 2019-11-22 7 F NN 8: Monitor15.txt 2019-11-17 2019-11-22 8 F NN 9: Monitor15.txt 2019-11-17 2019-11-22 9 F NN 10: Monitor15.txt 2019-11-17 2019-11-22 10 F NN 11: Monitor15.txt 2019-11-17 2019-11-22 11 F NN 12: Monitor15.txt 2019-11-17 2019-11-22 12 F NN 13: Monitor15.txt 2019-11-17 2019-11-22 13 F NN 14: Monitor15.txt 2019-11-17 2019-11-22 14 F NN 15: Monitor15.txt 2019-11-17 2019-11-22 15 F NN 16: Monitor15.txt 2019-11-17 2019-11-22 16 F NN 17: Monitor15.txt 2019-11-17 2019-11-22 17 F NN 18: Monitor15.txt 2019-11-17 2019-11-22 18 F NN 19: Monitor15.txt 2019-11-17 2019-11-22 19 F NN 20: Monitor15.txt 2019-11-17 2019-11-22 20 F NN 21: Monitor15.txt 2019-11-17 2019-11-22 21 F NN 22: Monitor15.txt 2019-11-17 2019-11-22 22 F NN 23: Monitor15.txt 2019-11-17 2019-11-22 23 F NN 24: Monitor15.txt 2019-11-17 2019-11-22 24 F NN 25: Monitor15.txt 2019-11-17 2019-11-22 25 F NN 26: Monitor15.txt 2019-11-17 2019-11-22 26 F NN 27: Monitor15.txt 2019-11-17 2019-11-22 27 F NN 28: Monitor15.txt 2019-11-17 2019-11-22 28 F NN 29: Monitor15.txt 2019-11-17 2019-11-22 29 F NN 30: Monitor15.txt 2019-11-17 2019-11-22 30 F NN 31: Monitor15.txt 2019-11-17 2019-11-22 31 F NN 32: Monitor15.txt 2019-11-17 2019-11-22 32 F NN 33: Monitor19.txt 2019-11-17 2019-11-22 1 F RN 34: Monitor19.txt 2019-11-17 2019-11-22 2 F RN 35: Monitor19.txt 2019-11-17 2019-11-22 3 F RN 36: Monitor19.txt 2019-11-17 2019-11-22 4 F RN 37: Monitor19.txt 2019-11-17 2019-11-22 5 F RN 38: Monitor19.txt 2019-11-17 2019-11-22 6 F RN 39: Monitor19.txt 2019-11-17 2019-11-22 7 F RN 40: Monitor19.txt 2019-11-17 2019-11-22 8 F RN 41: Monitor19.txt 2019-11-17 2019-11-22 9 F RN 42: Monitor19.txt 2019-11-17 2019-11-22 10 F RN 43: Monitor19.txt 2019-11-17 2019-11-22 11 F RN 44: Monitor19.txt 2019-11-17 2019-11-22 12 F RN 45: Monitor19.txt 2019-11-17 2019-11-22 13 F RN 46: Monitor19.txt 2019-11-17 2019-11-22 14 F RN 47: Monitor19.txt 2019-11-17 2019-11-22 15 F RN 48: Monitor19.txt 2019-11-17 2019-11-22 16 F RN 49: Monitor19.txt 2019-11-17 2019-11-22 17 F RN 50: Monitor19.txt 2019-11-17 2019-11-22 18 F RN 51: Monitor19.txt 2019-11-17 2019-11-22 19 F RN 52: Monitor19.txt 2019-11-17 2019-11-22 20 F RN 53: Monitor19.txt 2019-11-17 2019-11-22 21 F RN 54: Monitor19.txt 2019-11-17 2019-11-22 22 F RN 55: Monitor19.txt 2019-11-17 2019-11-22 23 F RN 56: Monitor19.txt 2019-11-17 2019-11-22 24 F RN 57: Monitor19.txt 2019-11-17 2019-11-22 25 F RN 58: Monitor19.txt 2019-11-17 2019-11-22 26 F RN 59: Monitor19.txt 2019-11-17 2019-11-22 27 F RN 60: Monitor19.txt 2019-11-17 2019-11-22 28 F RN 61: Monitor19.txt 2019-11-17 2019-11-22 29 F RN 62: Monitor19.txt 2019-11-17 2019-11-22 30 F RN 63: Monitor19.txt 2019-11-17 2019-11-22 31 F RN 64: Monitor19.txt 2019-11-17 2019-11-22 32 F RN file start_datetime stop_datetime region_id sex condition metadata <- link_dam_metadata(metadata, result_dir = DATA_DIR) metadata dt<- load_dam(metadata) Error in find_dam_first_last_lines(path, start_datetime, stop_datetime, : No data in selected date range Thanks if you read and think about a possible solution. Regards archives-metadata&monitor.zip

qgeissmann commented 4 years ago

Hi @pericles-pendragon, thanks for reporting your issue! Firt of all, I can reproduce your issue, which is great. Secondly, I narrowed it down to the format of your DAM files. If you compare the ones I have been working with: https://github.com/rethomics/damr/blob/master/inst/extdata/M014.txt with yours, you will notice that the date entry is very different in your case, the format it actually more conventional (e.g. 2019-11-15). We can certainly patch the package to work with your format. Which DAMS software did you use, and did you postprocess the data somehow? Maybe you opened the files in a spreadsheet software and saved them?

qgeissmann commented 4 years ago

@pericles-pendragon Also, do you mind if I include one of your file /or segment of in the package as part of the test/samples?

pericles-pendragon commented 4 years ago

Hello. Of course yo can use my files for testing. Currently I can't access to the DAMS sofware (is in another campus). I changed the format, but another error emerges. The text editor is geany, and the ubuntu version is 18.04.3 LTS. Here is the pathway :

library(damr) Loading required package: behavr Loading required package: data.table data.table 1.12.8 using 2 threads (see ?getDTthreads). Latest news: r-datatable.com library(ggetho) Loading required package: ggplot2 library(behavr) DATA_DIR <- "/home/pendragon/Documents/trikinetics2" setwd(DATA_DIR) metadata <- fread("metadata.csv") metadata file start_datetime stop_datetime region_id sex genotype nutrition 1: Monitor15.txt 17 Nov 19 09:00 24 Nov 19 1 F LOF-5HT1A NN 2: Monitor15.txt 17 Nov 19 09:00 24 Nov 19 2 F LOF-5HT1A NN 3: Monitor15.txt 17 Nov 19 09:00 24 Nov 19 3 F LOF-5HT1A NN 4: Monitor15.txt 17 Nov 19 09:00 24 Nov 19 4 F LOF-5HT1A NN 5: Monitor15.txt 17 Nov 19 09:00 24 Nov 19 5 F LOF-5HT1A NN 33: Monitor19.txt 17 Nov 19 09:00 24 Nov 19 1 F LOF-5HT1A NN archves-2ndformat.zip

         file  start_datetime stop_datetime region_id sex  genotype nutrition

metadata <- link_dam_metadata(metadata, result_dir = DATA_DIR) Warning: 1 parsing failure. row col expected actual 1 -- date like 17 Nov 19 09:00

Error: 1 parsing failure

metadata <- link_dam_metadata(metadata, result_dir = DATA_DIR) Warning: 1 parsing failure. row col expected actual 1 -- date like 17 Nov 19 09:00

Error: 1 parsing failure

metadata <- fread("metadata.csv") metadata <- link_dam_metadata(metadata, result_dir = DATA_DIR) Warning: 1 parsing failure. row col expected actual 1 -- date like 17 Nov 19 09:00

Error: 1 parsing failure

metadata <- fread("metadata.csv") metadata <- link_dam_metadata(metadata, result_dir = DATA_DIR) **Warning: 1 parsing failure. row col expected actual 1 -- date like 17 Nov 19 09:00

Error: 1 parsing failure**

Thanks !

qgeissmann commented 4 years ago

Hey! great. so in metadata, the format is always "YYYY-MM-DD". Wich, in my opinion, is the best. So it will work if you just use the original metadata :crossed_fingers:. the reason is that I designed the metadata mechanism, so picked a date format that makes sense, but my users provided me with files that had the DAMS date format. I did not expect anything else. It would be great to know why your DAMS files have a different format...

qgeissmann commented 4 years ago

so it looks like the date field in the DAM files is actually all over the place. we have 2019-11-15, 15-11-2019, 15 Nov 2019 (possibly others :fearful: ). This is annoying and fairly hard to guess reliably. Perhaps we should add a date_format argument to read_dam_file. So users can override the default

qgeissmann commented 4 years ago

the next version of the package allows specifying the date format inside load_dam. closing. Not on CRAN yet, but can be installed through devtools::install_github() see (https://rethomics.github.io/intro.html#devtools)

mantouyangmeng commented 3 months ago

Hi, I'm trying to run the damr package, and when I run load_dam(metadata), I now keep getting "Error in find_dam_first_last_lines(path, start_datetime, stop_datetime,. No data in selected date range". I've searched for ways to fix this (such as following the help provided in the error), but it still continues to report the error, and was wondering if you've encountered this problem?