Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201919

Can formattable in R group a table by a variable?

$
0
0

Is it possible to produce a table using formattable which is grouped by one of the variables in the dataframe? The table could either be divided/split/grouped into separate tables printed consecutively or the groupings are separated within one table.

If not possible with formattable, what other packages and functions could be recommended to create nice looking tables according to the described needs?

In example with this data frame:

df <- tibble( 
     x = c(1:100),
     y = c("email","postal")[rep(c(1,2), times=50)],
     c = rep(c("cat1","cat2","cat3","cat4"), times=25) )

I would like formattable to produce either 4 tables based for each cat1 to cat4 in variable c for the two columns "x" and "y" or alternatively 1 table with 4 sections for each cat1 to cat4.

Hope anyone can help.


Viewing all articles
Browse latest Browse all 201919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>