我有以下数据:
data <- list( name = "Chris",
children_names = c("Alex", "John")
)
使用R&#39的模板引擎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
这不是我想要的。 什么是正确的方法?
答案 0 :(得分:1)
你可能已经想到了这一点,但万一你还没有:
BLOCK_SIZE