habitus-eu / hbGPS

R package to process GPS data collected in human behaviour with option to merge/utilise time series from accelerometer data
Apache License 2.0
2 stars 0 forks source link

Example of CSV file #24

Open olivier-turcotte opened 1 month ago

olivier-turcotte commented 1 month ago

Hi, I tried to understand the documentation about the format of the csv file. Maybe it's my english, but I can't wrap my head around the error message.

My csv filename is idnumber_date.csv and the columns are (with one line to show the format).

INDEX,TAG,DATE,TIME,latitude,longitude,height(m),speed(km/h),HEADING 1,TRUE,10/9/2024,15:39:03,48.405918N,71.245193W,180,4.4,103

When I tried to run

hbGPS(gps_file = fichier_gps2, 
      outputDir = dossier,
      idloc = 2)

The output was [Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class ‘"function"’ to a data.frame]

I then tried to dive into the code to see where the problem was without success.

Could you show me a example of a csv file that would fit the package please?

Thanks in advance

olivier-turcotte commented 1 month ago

As a complement,

In load_and_tidy_up_GPS, the error message was Specified time_format is %d/%m/%Y %H:%M:%SO we see 10/9/2024 15:39:12

Is there something I didn't see? Thanks

vincentvanhees commented 1 month ago

Did you check the test files that are inside the package: https://github.com/habitus-eu/hbGPS/tree/main/inst/testfiles The unit tests show how hbGPS is expected to use these files: https://github.com/habitus-eu/hbGPS/tree/main/tests/testthat

olivier-turcotte commented 1 month ago

I'm sorry, I didn't fully explore the files before opening the issue. I'm quite new to GitHub... usualIy I tend to rely more on the CRAN doc. My csv file lacks the "NSAT (USED/VIEW),SAT INFO (SID-SNR)" info. Is there a way to generate them? Or to use default values? Thanks in advance

vincentvanhees commented 1 month ago

At the moment the code expects these columns, but is flexible to their format as documented here: https://github.com/habitus-eu/hbGPS/blob/main/man/load_and_tidy_up_GPS.Rd. We need this satellite info to robustly handle indoor time, including sitting in a vehicle.

olivier-turcotte commented 1 month ago

The device's output doesn't contains satellite info, in this format at least. I have three choices (CSV, GPX or NMEA). I'll keep exploring since my hopes of using hbGPS are high! GPS_output

olivier-turcotte commented 1 month ago

When I chose the NMEA format, the output only displays GGA and RMC sentences, not GSV that would give me the satellite info hbGPS requires. I will contact the manufacturer for help with my device.

olivier-turcotte commented 1 month ago

Hi, Excuse my ignorance but I still have questions.

In load_and_tidy_up_GPS, it's still not clear for me how to interpret the satellite info:

_Satellite information: A column with at least the character string "sat info " where the valueformat can be "(1-1-1-10);(1-1-1-10)" or "#1-1-1-10;#1-1-1-10" where the number values per substring does not have to be 4 but the last value is always assumed to reflect SNR. If sat info is not available then the code assumes that there is a sid and snr, which when values are fused pairwise reflect the sat info value.

Satellites in view and used is either expected to be provided with column nsat(used/view) or nsat (used/view) where the value format can be used (view), used(view), used/view, or used / view. If nsat(used/view) column is not available the code will look for column nsat and sid. It then extracts from the sid column the number of satilites in view._

What is the meaning of the first 3 digits of "#1-1-1-10" ?

vincentvanhees commented 3 weeks ago

I do not know, I had no prior experience with GPS data and had to follow the recommendation by the group in Odense Denmark who hired me to develop hbGPS. You may want to reach out to them with your questions.