fawda123 / rStrava

Functions to access data from Strava's v3 API.
154 stars 31 forks source link

imperial units #98

Closed opus1993 closed 1 year ago

opus1993 commented 1 year ago

to get get_heat_map() to plot, I had to assign the attribute manually

attr(act_data, "unit_type") <- "imperial"

fawda123 commented 1 year ago

I cannot reproduce this error. However, the unit_type attribute is assigned with compile_activities() based on your decision and cannot be changed using get_heat_map() if you are using a actframe object as input.

You should see a warning as follows if the unit attribute in actframe does not match the units argument in get_heat_map(). The units argument doesn't do anything for actframe objects.

> get_heat_map(act_data, key = google_key, maptype = 'satellite', f = 1, size = 2, units = 'imperial', distlab = F)
Warning message:
In get_heat_map.actframe(act_data, key = google_key, maptype = "satellite",  :
  units does not match unit type, use compile_activities with different units

To remedy, you can recreate act_data with different units:

act_data <- compile_activities(my_acts, units = 'imperial')
get_heat_map(act_data, key = google_key)

Or, simply use my_acts as input to get_heat_map(). This will allow full use of the units argument.

get_heat_map(my_acts, key = google_key, units = 'imperial')
get_heat_map(my_acts, key = google_key, units = 'metric')
opus1993 commented 1 year ago

thank you