0
私は、次のデータを持っている:どのようにRウィスカーのテンプレートエンジンを使用して改行と番号付きリストを生成する
data <- list(name = "Chris",
children_names = c("Alex", "John")
)
Rのテンプレートエンジンを使用してwhisker、私はレンダリングされたときに、この出力、 を取得したい:
I am Chris
My children are:
Child No 1 is Alex
Child No 2 is John
これは私の現在のコードです:
library(whisker)
template <-
'I am {{name}}
My children are:
{{children_names}}
'
data <- list(name = "Chris",
children_names = c("Alex", "John")
)
text <- whisker.render(template, data)
cat(text)
# which produces:
# I am Chris
# My children are:
# Alex,John
W私は欲しいものではありません。 これを行う正しい方法は何ですか?