Skip to content

how to get users only for limited number of apps?  #30

Description

@gabrielburcea

Hello team,

I am trying to get the users for the limited number of apps not all of them. you get get_users function but do not have more parameters, to filter out only 22 apps rather than all of them from my rstudioconnect.

This is an example I have:

shiny_rsc <- get_usage_shiny(
  client,
  content_guid = '1095e595-c1ef-4208-82e5-3ada982facf6|e2c258d4-bc8b-4603-967f-6d8de4d71f87|128ff6d9-ef38-472a-974b-b16e7c47927b|b3a52251-8116-4db3-bd71-64d17fd0be61|5fccc9b3-4faa-4d22-bde3-d9c9fb3f0a04|a3bc70e1-10dc-421d-b28a-1b07dba3ab99|c56cbf6c-77ff-43dd-b3d5-4f68c21079cf|08cea12b-4b26-4294-9297-873ecb4ce389|d793eaa8-ebfe-4214-8228-d8e9822a442d|c90112dd-b70c-4308-a3a1-092d94a989ec|877854e6-4ed4-46e4-a6e4-d8bca4d8b7f2|5f8d0573-7db4-474a-b729-6ebf978d5b47|a2ec3ffb-0fe4-484c-8872-0ba859f9ff11|f2f1a502-e208-4c4a-ac64-2789f7d4ce37|cdb37cc5-ecb5-4118-91cd-0c98fddbae74|bb8e7d45-6d44-4221-b2b2-4bc97eb70bae|0ab807d2-ce61-4fc1-8f64-6d2a68bb6a82|21ebe383-d537-4803-a828-b32224a3ea72|80294881-5efe-4c3e-9cbb-3d6d942263e0|364d223f-e9e5-42f3-82a7-83a032827535|10b8935b-abda-4b7d-abed-b2c2e0bfc7cc|b1e2f2c8-25fe-45e0-95b9-8daac757ec85|91ee4a6a-0281-407e-9064-cd79a6515671|b1e2f2c8-25fe-45e0-95b9-8daac757ec85|0ab807d2-ce61-4fc1-8f64-6d2a68bb6a82',
  from = lubridate::today() - lubridate::ddays(30),
  limit = Inf) %>%
  filter(!is.na(ended)) %>%
  mutate(session_duration = as.numeric(difftime(ended, started, unit = c("sec"))))

Then I take the app names with this code:

shiny_rsc_titles <- shiny_rsc %>%
  count(content_guid) %>%
  pull(content_guid) %>%
  purrr::map_dfr(
    ~tibble(content_guid = .x, content_name = content_title(client, .x))
  ) %>%
  dplyr::left_join(shiny_rsc, shiny_rsc_titles, by = "content_guid")

And based now tried this code to get the users linked to my shiny_rsc_titles with this code:

users <- shiny_rsc_titles %>%
  pull(content_guid) %>%
  purrr::map_dfr(
    ~tibble(content_guid = .x, users = get_users(client, .x)) 
    ) %>%
    dplyr::left_join(shiny_rsc_titles, users, by = "content_guid")

Am I doing the right thing in order to get the users for the apps I am interested rather than all the apps?

I get an error :


Error in sprintf("v1/users?page_number=%d&page_size=%d", page_number,  : 
  invalid format '%d'; use format %s for character objects

Please help?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions