Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"daterangeday" as first/only dimension only returning the top 5 #141

Open
gilliganondata opened this issue May 2, 2022 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@gilliganondata
Copy link
Collaborator

It seems like the expected "return all" when the first dimension is a date is not working under some conditions.

When I run the following:

df <- aw_freeform_table(company_id, rsid,
                        date_range = c("2020-05-01", "2022-04-30"),
                        dimensions = "daterangeday",
                        metrics = "visits")

I get the following message/results:

Requesting data...
Done!
Returning 5 x 2 data frame

It appears that it's using the actual default of 5 for top, even though the top dimension is a daterange... one.

It was easy enough to work around by adding top=1000, but the behavior runs counter to the documentation.

This is R v4.1.3 with adobeanalyticsr v0.3.2.

@gilliganondata gilliganondata added the bug Something isn't working label May 2, 2022
@benrwoodard
Copy link
Owner

Using a 0 value to the top argument, top = 0, will get you the number of days expected. It definitely would make sense to automatically interpret 'daterangeday' as the number of days in the date range. I think I just stopped short of doing that due to the assumed need for someone to define a specific number of days if it was used in a series of dimensions. Maybe due to using an attribution model defined metric?

@benrwoodard benrwoodard self-assigned this May 2, 2022
@charlie-gallagher
Copy link
Collaborator

Ach yeah current behavior doesn't match the documentation. Must've slipped through the unit tests. @benrwoodard this happens in make_explicit_top, which also has unit tests we can update.

On a user-interface note, I agree with Ben and probably would take this a bit further. I don't see why we should make it impossible to let users return the top 5 minutes or hours. I think this would be easier to use and implement if we just had two rules:

  • top uses whatever value you give it
  • If the top value for a date dimension is 0, it is replaced with the full date range.

Then there are the normal recycling rules, which most R users are familiar with.

@gilliganondata
Copy link
Collaborator Author

Okay. Yeah. I thought I'd tested this way back with the initial release and it behaved as its documented. But, it seems totally fine to make it a documentation bug—adding top = 0 is easy enough to use in code.

Interestingly, of course, if you don't specify (so it's top=5) or if you do specify a value that is less than the total date range, it's going to return the "top X days based on the first metric." That's actually a potentially (?) useful application: "I'd like to know what the top 10 days for revenue over the past year were"... a top=10 with daterangeday is going to return that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants