What is the best way to read this type of character vector?
"global warming" OR "carbon sink" OR biodiversity OR conservation OR "global change"
and transform it to
"global+warming"+OR+"carbon+sink"+OR+biodiversity+OR+conservation+OR+"global+change"
Is that what you want ?
text <- c("global warming" , "OR" , "carbon sink" , "OR" , "biodiversity" , "OR" , "conservation" , "OR" , "global change")
gsub(" " , "+" , do.call(paste , as.list(text)))
 
    
    Assuming your string is read from a file /tmp/test you could try something like this:
st = readLines('/tmp/test')
gsub('\\s+', '+', gsub('\\\\|\\"', '', st))
 
    
    Do you want something like:
s <- '"global warming" OR "carbon sink" OR biodiversity OR conservation OR "global change"'
cat(gsub(" ", "+", s))
#"global+warming"+OR+"carbon+sink"+OR+biodiversity+OR+conservation+OR+"global+change"
Without ".
cat(gsub('"', "", gsub(" ", "+", s)))
#global+warming+OR+carbon+sink+OR+biodiversity+OR+conservation+OR+global+change
