My data is contained in the following csv
file, which has the following format:
ind h1 h2 x
1 a aa k
2 a ab m
3 b ba n
4 b bb p
And I want to convert this into this markdown
file:
# a
## aa
k
## ab
m
# b
## ba
n
## bb
p
CodePudding user response:
Assume dt
is the dataframe from csv,
library(glue)
library(magrittr)
with(dt,{
'\n#{h1}\n##{h2}\n{x}\n' %>% glue
}) %>% writeLines(., con = 'out.md')