Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Error: arguments imply differing number of rows #15
Hi! I'm trying to load in Strava data and I get the following error when trying to run the
I'm not familiar with the structure of .gpx files so I was hoping you could shed some insight?
It looks like it is trying to process three files but is returning empty data for each file. I'm not sure that I can be of much help without seeing the gpx files. I noticed Strava no longer allows bulk export of gpx files, so maybe your files are in a different format that process_data isn't set up for. The only other thing I can suggest is upgrading to the latest version of R if you haven't already.
I also saw the first error.
When you upload to Strava, they make "corrections" on the file, for example to try and fix rogue elevation data.
Pre-GPDR, you could bulk export all your activities as GPX files, I think these were the corrected ones.
These visualisation tools were fine with them, maybe Strava standardised them.
Post-GDPR, you can export an archive of your account which includes much more data, however your activities are now in their original file format. For me, that was GPX for GPX files I uploaded from another service, and from the Strava Android app, and FIT format from my Wahoo GPS tracker.
These tools were fine with the GPX files. I tried converting the FIT files to GPX using GPSBabel, and also FIT-to-GPX, but these tools gave
I think Strava should probably still be offering the corrected tracks under GDPR.
I'll retest the with the latest version of this package.
macOS High Sierra 10.13
Here's a test using a FIT file converted to GPX using:
testing.zip contains the input FIT file, the three GPX files, and the output plots.
$ R R version 3.5.1 (2018-07-02) -- "Feather Spray" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin17.6.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(strava) > library(tidyverse) ── Attaching packages ─────────────────────────────────────── tidyverse 1.2.1 ── ✔ ggplot2 3.0.0 ✔ purrr 0.2.5 ✔ tibble 1.4.2 ✔ dplyr 0.7.6 ✔ tidyr 0.8.1 ✔ stringr 1.3.1 ✔ readr 1.1.1 ✔ forcats 0.3.0 ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── ✖ dplyr::filter() masks stats::filter() ✖ dplyr::lag() masks stats::lag() > data <- process_data("fit2gpx") Error in data.frame(lat = lat, lon = lon, ele = ele, time = time, type = type) : arguments imply differing number of rows: 10754, 10715, 1 > data <- process_data("gpsbabel") Error in data.frame(lat = lat, lon = lon, ele = ele, time = time, type = type) : arguments imply differing number of rows: 10754, 10715, 1 > data <- process_data("strava-export") > p1 <- plot_facets(data) > ggsave("plots/facets-strava-export.png", p1, width = 20, height = 20, units = "cm") > p2 <- plot_map(data, lon_min = 22.65, lon_max = 26.65, lat_min = 59.61, lat_max = 60.84) # Uusimaa > ggsave("plots/map-strava-export.png", p2, width = 20, height = 15, units = "cm", dpi = 600) > p3 <- plot_elevations(data) > ggsave("plots/elevations-strava-export.png", p3, width = 20, height = 20, units = "cm") >
Both the problem files have 10754
Thanks for the tips FTR you can still bulk download GPX files under
I've attached one of my GPX files (zipped, apparently github doesn't like .gpx), I have ZERO familiarity with their structure, would you mind taking a peek to see if they're in the correct format? The extension is .gpx but maybe I need to convert them?
I also get an error with that attached file:
> data <- process_data("/tmp/Downloads/1969459350") Error in data.frame(lat = lat, lon = lon, ele = ele, time = time, type = type) : arguments imply differing number of rows: 1366, 0, 1
It is indeed in GPX format, which is a type of XML file.
Here's an idea.
My working exported file is made up of points like this:
<trkpt lat="60.1756950" lon="24.9218050"> <ele>18.8</ele> <time>2018-06-01T13:19:48Z</time> <extensions> <gpxtpx:TrackPointExtension></gpxtpx:TrackPointExtension> </extensions> </trkpt>
Not working 1969459350.gpx is like this:
<trkpt lat="40.6627840" lon="-73.9653840"> <time>2018-07-25T23:11:06+00:00</time> <extensions> <gpxtpx:TrackPointExtension> <gpxtpx:cad>0</gpxtpx:cad> </gpxtpx:TrackPointExtension> </extensions> </trkpt>
Not working 1730574024.fit.fit2gpx.gpx:
<trkpt lat="60.175695056" lon="24.921805004"> <time>2018-06-01T13:20:21Z</time> <speed>0.000000</speed> </trkpt>
Not working 1730574024.fit.gpsbabel.gpx:
<trkpt lat="60.175695056" lon="24.921805004"> <time>2018-06-01T13:20:21Z</time> <speed>0.000000</speed>
Elevation is obviously needed for
There may also be a problem with getting
<name>Afternoon Ride</name> <type>1</type>
Correcting myself, when I said:
My two converted files do have some
Error in data.frame(lat = lat, lon = lon, ele = ele, time = time, type = type) : arguments imply differing number of rows: 10754, 10715, 1
Strava makes altitude corrections, that'll be why their exports all have points with elevation values but some original files do not.