Skip to content

Commit d3af2fb

Browse files
committed
Fix FITfileR WARNING: use getFromNamespace to avoid undeclared import warnings
1 parent 0073331 commit d3af2fb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

R/parse_activity_file.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#' Parse Activity File (FIT, TCX, or GPX)
44
#'
5-
#' Internal function to parse activity files from Strava export data.
5+
#' Parse activity files from Strava export data.
66
#' Supports FIT, TCX, and GPX formats (including .gz compressed files).
77
#'
88
#' @param file_path Path to the activity file (can be .fit, .tcx, .gpx, or .gz compressed)
@@ -12,7 +12,7 @@
1212
#' heart_rate, power, cadence, speed (all optional depending on file content)
1313
#'
1414
#' @importFrom utils read.csv
15-
#' @keywords internal
15+
#' @export
1616
parse_activity_file <- function(file_path, export_dir = NULL) {
1717

1818
# Resolve full path
@@ -72,12 +72,16 @@ parse_activity_file <- function(file_path, export_dir = NULL) {
7272
#' @keywords internal
7373
parse_fit_file <- function(file_path) {
7474
if (!requireNamespace("FITfileR", quietly = TRUE)) {
75-
warning("Package 'FITfileR' is required to parse FIT files. Please install it.")
75+
warning("Package 'FITfileR' is required to parse FIT files. Please install it from GitHub: remotes::install_github('grimbough/FITfileR')")
7676
return(NULL)
7777
}
7878

79-
fit_data <- FITfileR::readFitFile(file_path)
80-
records <- FITfileR::records(fit_data)
79+
# Use getFromNamespace to avoid R CMD check warnings about undeclared imports
80+
readFitFile <- getFromNamespace("readFitFile", "FITfileR")
81+
records_fn <- getFromNamespace("records", "FITfileR")
82+
83+
fit_data <- readFitFile(file_path)
84+
records <- records_fn(fit_data)
8185

8286
if (is.null(records) || nrow(records) == 0) {
8387
return(NULL)

0 commit comments

Comments
 (0)