Closed IllustratedMan-code closed 4 years ago
I just tested it with the toy data as well. I get the same error.
any chance you can actually put the code you are trying to run with the toy data?
I did not even have the toy data downloaded when I got the error.
And I kept the toy data and test code isolated in it's own folder
I mean, I cannot help unless you provide an example of code that does fail... ideally, somethine I can reproduce (e.g. with minimal data, or uding the package's data)
library(damr)
setwd("/home/david/Documents/R/damr_tutorial")
list.files()
m <- fread("metadata.csv")
metadata <- link_dam_metadata(m, result_dir = "/home/david/Documents/R/damr_tutorial")
data <- load_dam(metadata)
print(data)
This is my test code with the sample data
list.files() outputs
"metadata.csv" "Monitor11.txt" "Monitor14.txt" "Monitor64.txt"
Thank you for all your help so far.
And the error is on load_dam()?
, or before onlink_dam_metadata()?
Are you just using the data from the tutorial, or your own, or have you changed anything? Same question for the metadata.
what is the result of print(m)
, if possible, what is the result of print(metadata)
. thanks!
The error is on load_dam(). This is just the data from the tutorial. I have not changed anything. I am going to go ahead and copy the results of print(m) and print(metadata)
print(m):
file start_datetime stop_datetime region_id sex genotype replicate
1: Monitor11.txt 2017-07-01 08:00:00 2017-07-04 1 M A 1
2: Monitor11.txt 2017-07-01 08:00:00 2017-07-04 2 M A 1
3: Monitor11.txt 2017-07-01 08:00:00 2017-07-04 3 M A 1
4: Monitor11.txt 2017-07-01 08:00:00 2017-07-04 4 M A 1
5: Monitor11.txt 2017-07-01 08:00:00 2017-07-04 5 M A 1
---
188: Monitor64.txt 2017-07-11 08:00:00 2017-07-14 28 F C 2
189: Monitor64.txt 2017-07-11 08:00:00 2017-07-14 29 F C 2
190: Monitor64.txt 2017-07-11 08:00:00 2017-07-14 30 F C 2
191: Monitor64.txt 2017-07-11 08:00:00 2017-07-14 31 F C 2
192: Monitor64.txt 2017-07-11 08:00:00 2017-07-14 32 F C 2
print(metadata):
id file_info start_datetime stop_datetime region_id sex genotype replicate
1: 2017-07-01 08:00:00|Monitor11.txt|01 <list[2]> 2017-07-01 08:00:00 2017-07-04 1 M A 1
2: 2017-07-01 08:00:00|Monitor11.txt|02 <list[2]> 2017-07-01 08:00:00 2017-07-04 2 M A 1
3: 2017-07-01 08:00:00|Monitor11.txt|03 <list[2]> 2017-07-01 08:00:00 2017-07-04 3 M A 1
4: 2017-07-01 08:00:00|Monitor11.txt|04 <list[2]> 2017-07-01 08:00:00 2017-07-04 4 M A 1
5: 2017-07-01 08:00:00|Monitor11.txt|05 <list[2]> 2017-07-01 08:00:00 2017-07-04 5 M A 1
---
188: 2017-07-11 08:00:00|Monitor64.txt|28 <list[2]> 2017-07-11 08:00:00 2017-07-14 28 F C 2
189: 2017-07-11 08:00:00|Monitor64.txt|29 <list[2]> 2017-07-11 08:00:00 2017-07-14 29 F C 2
190: 2017-07-11 08:00:00|Monitor64.txt|30 <list[2]> 2017-07-11 08:00:00 2017-07-14 30 F C 2
191: 2017-07-11 08:00:00|Monitor64.txt|31 <list[2]> 2017-07-11 08:00:00 2017-07-14 31 F C 2
192: 2017-07-11 08:00:00|Monitor64.txt|32 <list[2]> 2017-07-11 08:00:00 2017-07-14 32 F C 2
-01 08:00:00 2017-07-04 1 M A 1
2: 2017-07-01 08:00:00|Monitor11.txt|02 <list[2]> 2017-07-01 08:00:00 2017-07-04 2 M A 1
3: 2017-07-01 08:00:00|Monitor11.txt|03 <list[2]> 2017-07-01 08:00:00 2017-07-04 3 M A 1
4: 2017-07-01 08:00:00|Monitor11.txt|04 <list[2]> 2017-07-01 08:00:00 2017-07-04 4 M A 1
5: 2017-07-01 08:00:00|Monitor11.txt|05 <list[2]> 2017-07-01 08:00:00 2017-07-04 5 M A 1
---
188: 2017-07-11 08:00:00|Monitor64.txt|28 <list[2]> 2017-07-11 08:00:00 2017-07-14 28 F C 2
189: 2017-07-11 08:00:00|Monitor64.txt|29 <list[2]> 2017-07-11 08:00:00 2017-07-14 29 F C 2
190: 2017-07-11 08:00:00|Monitor64.txt|30 <list[2]> 2017-07-11 08:00:00 2017-07-14 30 F C 2
191: 2017-07-11 08:00:00|Monitor64.txt|31 <list[2]> 2017-07-11 08:00:00 2017-07-14 31 F C 2
192: 2017-07-11 08:00:00|Monitor64.txt|32 <list[2]> 2017-07-11 08:00:00 2017-07-14 32 F C 2
Sorry about the formatting, not the best githubber
Here is the windows 10 code (that works). The only difference is the directory
library(damr)
setwd("C:/Users/dalew/OneDrive/Documents/BioResearch/Rethomicstester")
list.files()
m <- fread("metadata.csv")
metadata <- link_dam_metadata(m, result_dir = "C:/Users/dalew/OneDrive/Documents/BioResearch/Rethomicstester")
data <- load_dam(metadata)
print(data)
can you print str(metadata)
. So far, it looks like the time, in your metadata file is not the right format as expected...
str(metadata):
Classes ‘data.table’ and 'data.frame': 192 obs. of 8 variables:
$ id : Factor w/ 192 levels "2017-07-01 08:00:00|Monitor11.txt|01",..: 1 2 3 4 5 6 7 8 9 10 ...
$ file_info :List of 192
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor14.txt"
.. ..$ file: chr "Monitor14.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor64.txt"
.. ..$ file: chr "Monitor64.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
..$ :List of 2
.. ..$ path: chr "/home/david/Documents/R/damr_tutorial/Monitor11.txt"
.. ..$ file: chr "Monitor11.txt"
.. [list output truncated]
$ start_datetime: chr "2017-07-01 08:00:00" "2017-07-01 08:00:00" "2017-07-01 08:00:00" "2017-07-01 08:00:00" ...
$ stop_datetime : IDate, format: "2017-07-04" "2017-07-04" "2017-07-04" "2017-07-04" ...
$ region_id : int 1 2 3 4 5 6 7 8 9 10 ...
$ sex : chr "M" "M" "M" "M" ...
$ genotype : chr "A" "A" "A" "A" ...
$ replicate : int 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "sorted")= chr "id"
- attr(*, ".internal.selfref")=<externalptr>
can you try to explicitly convert your IDate to a POSIXct:
metadata[ , stop_date := as.POSIXct(stop_datetime)]
str(metadata)
load_dam(...)
So it works if I did your command as metadata[ , stop_datetime := as.POSIXct(stop_datetime)]
rather thanmetadata[ , stop_date := as.POSIXct(stop_datetime)]
The other way gave me the same error.
Any idea why I have to make this conversion on linux but not windows?
a yes, sorry that was a typo on my side. so we have a patch for now...? and then I can force that to happen internally in your case...
Yep. Everything seems to work after making the conversion.
marked as fixed, not yet on CRAN, but should work on the github version of the package as of today
When I run my code in windows everything works fine but when I try to run the same code in ubuntu (with directories changed accordingly) I get this error:
Error in parse_datetime(stop_datetime, tz = tz) : Unexpected type for x
It seems to have something to do with the as.character conversion but I don't really know. Any ideas?