There's a problem in your function. Replace all instances of link
with url.name
and it will work.
# library(XML); library(tm)
create.corpus <- function(url.name){
doc=htmlParse(url.name)
parag=xpathSApply(doc,'//p',xmlValue)
cc=Corpus(VectorSource(parag))
meta(cc,type='corpus','link') <- url.name
return(cc)
}
cc <- lapply(link, create.corpus)
The result:
> cc
[[1]]
A corpus with 48 text documents
[[2]]
A corpus with 2 text documents
[[3]]
A corpus with 41 text documents
[[4]]
A corpus with 25 text documents
[[5]]
A corpus with 39 text documents