Другой подход:
library (XML)
library(RCurl)
data=htmlParse("http://demoqa.com/autocomplete/")
result=xpathSApply(data,"normalize-space(substring-before(substring-after(//div[@class='demo-frame']//script[last()]/text(),'['),']'))")
reg=gsub('\"',"",result)
final=unlist(strsplit(reg,", "))
Производит:
[1] "ActionScript" "AppleScript" "Asp" "BASIC" "C" "C++"
[7] "Clojure" "COBOL" "ColdFusion" "Erlang" "Fortran" "Groovy"
[13] "Haskell" "Java" "JavaScript" "Lisp" "Perl" "PHP"
[19] "Python" "Ruby" "Scala" "Scheme"