rethomics / damr

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

Error in load_dam #27

Closed mrs98 closed 4 years ago

mrs98 commented 4 years ago

Hello! I succesfully completed the tutorial for this package, but am running into trouble at the load_dam command while trying to use my own data. I am hoping somebody can help, because I'm currently stumped:

library(ggetho) library(zeitgebr) library(damr) library(behavr) library(data.table)

DATA_DIR = ("~/PSU/Data/Drug Manipulation Experiment/AWD Backups/6-4-20 AWD Files")

list.files(DATA_DIR, pattern= ".txt|.csv") [1] "metadata.csv" "Wheater Compiled.txt"

setwd(DATA_DIR)

metadata = link_dam_metadata("metadata.csv", result_dir = DATA_DIR) metadata id file_info start_datetime stop_datetime region_id sex bird name 1: 2020-06-04 06:00:00|Wheatear Compiled.txt|01 2020-06-04 06:00:00 2020-06-23 1 M Wheatear 1 2: 2020-06-04 06:00:00|Wheatear Compiled.txt|02 2020-06-04 06:00:00 2020-06-23 2 F Wheatear 2 3: 2020-06-04 06:00:00|Wheatear Compiled.txt|03 2020-06-04 06:00:00 2020-06-23 3 M Wheatear 3 4: 2020-06-04 06:00:00|Wheatear Compiled.txt|04 2020-06-04 06:00:00 2020-06-23 4 F Wheatear 4 5: 2020-06-04 06:00:00|Wheatear Compiled.txt|05 2020-06-04 06:00:00 2020-06-23 5 M Wheatear 5 6: 2020-06-04 06:00:00|Wheatear Compiled.txt|06 2020-06-04 06:00:00 2020-06-23 6 F Wheatear 6 7: 2020-06-04 06:00:00|Wheatear Compiled.txt|07 2020-06-04 06:00:00 2020-06-23 7 M Wheatear 7 8: 2020-06-04 06:00:00|Wheatear Compiled.txt|08 2020-06-04 06:00:00 2020-06-23 8 F Wheatear 8 treatment 1: none 2: none 3: none 4: none 5: none 6: none

dt=load_dam(metadata) Taking input= as a system command ('~/PSU/Data/Drug Manipulation Experiment/AWD Backups/6-4-20 AWD Files/Wheatear Compiled.txt') and a variable has been used in the expression passed to input=. Please use fread(cmd=...). There is a security concern if you are creating an app, and the app could have a malicious user, and the app is not running in a secure environment; e.g. the app is running as root. Please read item 5 in the NEWS file for v1.11.6 for more information and for the option to suppress this message. '~' is not recognized as an internal or external command, operable program or batch file. Error in paste(date, time, sep = " ") : cannot coerce type 'closure' to vector of type 'character' In addition: Warning messages: 1: In (if (.Platform$OS.type == "unix") system else shell)(paste0("(", : '(C:/Users/Madalyn/Documents/PSU/Data/Drug Manipulation Experiment/AWD Backups/6-4-20 AWD Files/Wheatear Compiled.txt) > C:\Users\Madalyn\AppData\Local\Temp\RtmpYJth4P\file3020247d65a1' execution failed with error code 1 2: In fun(file, col.names = names(DAM5_COLS)[cols_to_keep], select = cols_to_keep) : File 'C:\Users\Madalyn\AppData\Local\Temp\RtmpYJth4P\file3020247d65a1' has size 0. Returning a NULL data.table.

Wheater Compiled.txt metadata.txt

qgeissmann commented 4 years ago

Hi @mrs98, thanks for reporting your issue.

I had a look and, the name of the file in the metadata does not match "Wheatear Compiled.txt" in metadata vs "Wheater.Compiled.txt" in the file system. It would make your life a lot easier if you did not use space in filenames, so i suggest changing the metatada entries to "Wheater.Compiled.txt" (rather than renaming the file). (note that you also have "Wheater" vs "Wheatear") It is possible that your original file name had a spae, but github also hate spaces as it serves your file on https://github.com/rethomics/damr/files/4858315/Wheater.Compiled.txt, which cannot contain a space either.

I am able to go further but then when I load the data:

library(damr)

DATA_DIR = ("./")
metadata = link_dam_metadata("metadata.txt", result_dir = DATA_DIR)
dt = load_dam(metadata)

However, I run into another issue:

Error in find_dam_first_last_lines(path, start_datetime, stop_datetime,  : 
  No data in selected date range

This is related to how your DAMS result file is formated. We should open a new issue just for that. TBC

qgeissmann commented 4 years ago

so regarding not being able to find any data (after you fixed the first hurdle). your issue is similar to #26. this is because the format of DAM text file is inconsistent... I will update on #26. closing this issue