animalnexus / feedr

R package for working with data collected from RFID feeder visits
https://animalnexus.github.io/feedr/
2 stars 1 forks source link

load_raw_all #12

Open KaraS106 opened 5 months ago

KaraS106 commented 5 months ago

Hello! I am trying to figure out the best way to load all of my logger data. I have one Folder "data" with several txt files from different loggers. I would like to load and combine the files and have the logger_id be the name of the file. the file names are 2 different formats: one is for example RF05DATA.TXT and the other is RF07_D03.TXT

I have tried load_raw_all

r<- load_raw_all(r_dir = "~/Desktop/RFID Analysis/RFID_Analysis/RFID/data", details = 0)

and I got these errors: Loading file /Users/karasnow/Desktop/RFID Analysis/RFID_Analysis/RFID/data/RF01DATA.TXT... Error in utils::read.table(r_file, col.names = c("animal_id", "date", : duplicate 'row.names' are not allowed In addition: Warning messages: 1: In utils::read.table(r_file, col.names = c("animal_id", "date", : header and 'col.names' are of different lengths 2: In stop(c, call. = FALSE) : additional arguments ignored in stop()

steffilazerte commented 5 months ago

Hi @KaraS106,

This will really depend on what your data files look like. The load_raw() and load_raw_all() functions are designed to work with data that has three columns (animal_id, date, and time). It's flexible enough to handle a couple of different formats, but was designed for the typical loggers in use about 7 years ago (which may not the format in use now).

I suggest taking a close look at your logger files and the options in load_raw(). You can see the documentation for these functions with ? eg. ?load_raw(). Try looking at your files and see if you can read a single file with load_raw(). If not, you'll probably have to load them yourself (consider read_csv()), just make sure the final data has animal_id, time (date/time) and logger_id.

If you're still struggling after this, post the first 30 lines of an example data file here, and I'll see if I can't get you some more specific suggestions 😁

Good luck!