You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to extract the facet to page mapping when using facet_wrap_paginate() and facet_grid_paginate()? I'm hoping that there is a function like paginate_data_map() (which I know doesn't exist) that would extract the information of which facet is on which page similar to the example below:
# desired output would be a data.frame or tibble that looks something like the# following with one column for the page and more columns for each of thedata.frame(
page= c(1, 1, 1, 1, 2),
cyl= c(4, 6, 8, 12, 16)
)
#> page cyl#> 1 1 4#> 2 1 6#> 3 1 8#> 4 1 12#> 5 2 16
If plot does not use facet_wrap_paginate() or facet_grid_paginate(), it would return NULL, equivalent to `n_pages().
Alternative thoughts could be:
If it uses facet_wrap() or facet_grid(), it could do the same extraction where page is always set to 1 in the data, and the columns are still extracted.
And, if it does not use facets, it could return data.frame(page = 1).
Check if one of the faceting variables is named page, and if so, choose a different name for the page column with a warning.
Alternatively, use the name .page so that it is very unlikely to have a collision, and if there is a collision, add more dots to the beginning of .page until there is no collision (so ..page would be tested next). This would also have a warning.
Is there any way to extract the facet to page mapping when using
facet_wrap_paginate()
andfacet_grid_paginate()
? I'm hoping that there is a function likepaginate_data_map()
(which I know doesn't exist) that would extract the information of which facet is on which page similar to the example below:Created on 2024-03-24 with reprex v2.1.0
If it doesn't exist and would be of interest, I could try to make a PR for it with guidance about where to find the information within the gg object.
FYI, this is for use in the
ggtibble
package so that I can automatically expand the pages into agglist
andggtibble
object there.The text was updated successfully, but these errors were encountered: