Pandoc places curly brackets around square brackets

A question with the same title has been answered on Stackoverflow and I can confirm that, in a terminal, $ echo '\mycommand[options]{something}' | pandoc -t latex works fine, square brackets are untouched.
Nonetheless, invoking pandoc through rmarkdown::render() the process aborts with the following message:

! Undefined control sequence.
l.90 \newcolumntype
                   {L}{[}1{]}\{\textgreater{}\{\raggedright

The message shows that curly brackets have been placed around the square brackets.
This is the example Rmd I used:

---
title: "R Notebook"
output: pdf_document
---
some text
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
other text

Is the difference in the outputs due to some of the pandoc command-line option?
This is what I can read in R console:

"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS PandocSquareBracket.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output PandocSquareBracket.tex --template "C:\Users\ro\Documents\R\win-library\3.5\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --pdf-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --variable "compact-title:yes"

How can I get the line working as Latex command?
Many thanks, Roberto