fawda123 / rStrava

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

Unable to use get_activity_streams() #55

Closed rafaelschlatter closed 5 years ago

rafaelschlatter commented 5 years ago

Hi,

I am not able to use the get_activity_streams() function. When using the function as in the example in get_activity_streams.R, line 28, I get the following error:

Error: Each column must either be a list of vectors or a list of data frames [altitude,cadence,distance,grade_smooth,heartrate,latlng,moving,time,velocity_smooth]

Do you know what is going on? The function arguments I used are as described by the documentation.

Regards, Rafael

fawda123 commented 5 years ago

Does your activity list download correctly (line 26 in the the example)?

rafaelschlatter commented 5 years ago

Yes, I send in a list of activities (the result of get_activity_list()). This is the stacktrace:

rlang::last_error()

message: Each column must either be a list of vectors or a list of data frames [altitude,cadence,distance,grade_smooth,heartrate,latlng,moving,time,velocity_smooth] class: `rlang_error` backtrace: 1. rStrava::get_activity_streams(my_acts, stoken, acts = 1:2) 2. rStrava:::get_activity_streams.list(my_acts, stoken, acts = 1:2) 3. rStrava:::get_activity_streams.actframe(...) 4. purrr::map2_dfr(streams, list.ids, compile_activity_streams) 5. purrr::map2(.x, .y, .f, ...) 6. rStrava:::.f(.x[[i]], .y[[i]], ...) 7. tidyr::spread(data = ., key = type, value = data) 16. tidyr::unnest(.)

Interestingly, when I omit the acts argument, I get a 404. Do you reckon this second error has something todo with permissions? My scope is view_private.

rafaelschlatter commented 5 years ago

I just did a check with get_streams() with a single Id and I get a useful result (list of 9, with all stream types data available).

fawda123 commented 5 years ago

Yea I also get the 404 error when acts argument is omitted. My account is not private so I don't think it's a scope issue. Maybe @lgaborini can help - he wrote the function.

lgaborini commented 5 years ago

My code works even without acts, and I also have full stream data.
Are there maybe missing values or list-columns somewhere in the get_streams() dataset?

rafaelschlatter commented 5 years ago

The code works for you, but it does not for me, there is something going on.

With get_streams() I get a list of lists, one per stream, which contains a number of different datatypes. I realized that depending on the type of activity, some streams are missing (could also depend on the device you are recording the activity I imagine), but missing streams are not a problem in the get_streams() function.

@lgaborini are you maybe referring to the get_activity_list() function? The result of that function can be used as an input to get_activity_streams(). Are you saying that get_activity_streams() does not work if the result from get_activity_list() contains list-columns? Can you specify what your input to get_activity_streams() looks like?