I am facing an issue as how to presenting data in a list as table (data frame) format, in the list each element as a character vector, and these vectors may have different length, the example list as below:
sample_list <- list("Matched x" = c("Ella", "Mila"), "Unmatched x" = c("Isla"), "Matched y" = c(), "Unmatched y" = c("Emma", "Olivia"))
sample_list
Normally, if you use str(sample_list)
, it will print as below:
> str(sample_list)
List of 4
$ Matched x : chr [1:2] "Ella" "Mila"
$ Unmatched x: chr "Isla"
$ Matched y : NULL
$ Unmatched y: chr [1:2] "Emma" "Olivia"
Is there a way to show the result on R markdown
(.Rmd
file) generated file (e.g .html
/ .pdf
) as below (no need strictly same but like table style) ?