<% document.document_versions.each do |version| %>
似乎将整个矢量转换为单个字符串 -
toString
如何映射每个元素的字符串转换;即,对于上面的例子,获得toString(c(1,2))
[1] "1, 2"
?
答案 0 :(得分:2)
module joint{
export module shapes{
export module org{
export class NewRect{
...
}
export class NewRectView{
...
}
}
}
}
Is the output I get from the R-console.
答案 1 :(得分:1)
由于结果是具有单个元素的字符向量,因此使用as.character
的策略将不起作用。需要使用scan
:
> scan(text = toString(0:11), sep="," )
Read 12 items
[1] 0 1 2 3 4 5 6 7 8 9 10 11
如果需要,您可以使用as.character
:
> res <- scan(text = toString(0:11), sep="," )
Read 12 items
> as.character(res)
[1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11"
答案 2 :(得分:0)
我更喜欢paste0
,因为它更短,而且(据我所知)完成与as.character
相同的事情:
> paste0(1:2)
[1] "1" "2"
> identical(paste0(1:2),as.character(1:2))
[1] TRUE