I have some data, example below, where i have used the base package 'table' creating a pivot with three objects. the table, as a list of values, prints how I'd like to see it, but it isn't formatted presentation quality. I'm wanting a pack_row (if i could get that to work) where a heading is "Country" while "Orbit", "Frequency" & "Type" are in 2 column and 1 row. If i make a dataframe from this, I get "Country" printed out 6 times where I'd rather have a heading only.
here is some reproducible code. My work has about 60 "Country", and this is a minimal example:
{r initial}
library(knitr)
library(kableExtra)
#####
df <- data.frame(Country = c("AUS", "AUS", "GER","GER"),
Orbit = c("GEO","LEO","GEO","LEO"),
Type = c("TBD","Payload","Debris","Payload"),
Freq = c(1,2,4,8)
)
tbl <- table(df$Type, df$Orbit, df$Country, exclude = NA)
output <- as.data.frame(table(df$Type, df$Orbit, df$Country, exclude = NA) )
colnames(output) <- c("Type","Orbit","Country","Frequency")
output
kable(output)
Any ideas on how to format this nicely into an RMarkdown html output? thank you!