R将list中的双引号保留为String

时间:2016-03-01 21:07:12

标签: r tostring

我有一个看起来像这样的列表

[1] "SCOPUS_ID:84942789431" "SCOPUS_ID:84928151617" "SCOPUS_ID:84939229259" "SCOPUS_ID:84946407175"
[5] "SCOPUS_ID:84933039513" "SCOPUS_ID:84942789431" "SCOPUS_ID:84942607254" "SCOPUS_ID:84948165954"
[9] "SCOPUS_ID:84926379258" "SCOPUS_ID:84946771354" "SCOPUS_ID:84944223683" "SCOPUS_ID:84942789431"
[13] "SCOPUS_ID:84939169499" "SCOPUS_ID:84947104346" "SCOPUS_ID:84948764343" "SCOPUS_ID:84938075139"
[17] "SCOPUS_ID:84946196118" "SCOPUS_ID:84930820238" "SCOPUS_ID:84947785321" "SCOPUS_ID:84933496680"
[21] "SCOPUS_ID:84942789431"

我想使用函数toString,但要保持双引号,使其看起来像这样

[1] " \"SCOPUS_ID:84942789431\", \"SCOPUS_ID:84928151617\", ... "

1 个答案:

答案 0 :(得分:0)

我承认我对你的要求感到相当困惑,但我认为这就是你想要的:

<controls:PageHeader x:Name="PageHeader" 
    Text="Payees" Frame="{x:Bind Frame}" />

我知道你说你不想使用x <- c("SCOPUS_ID:84942789431", "SCOPUS_ID:84928151617", "SCOPUS_ID:84939229259") paste('"', x, '"', sep = "", collapse = ", ") # [1] "\"SCOPUS_ID:84942789431\", \"SCOPUS_ID:84928151617\", \"SCOPUS_ID:84939229259\"" ,因为它需要2-3秒,但我想不出能给你现在想要的东西。我相信别人会有建议。