I want to iterate 'div' and 'withTags' to a text file after tokenizing the file . I have been able to iterate with div and withTags to untokenized text . However I am getting error when I iterate div & withTags after tokenizing it . Is there any way out of it ?
text<- "It's unclear what Florida victory McEnany and Trump were referring to, but last month, the Supreme Court rejected an emergency petition for Democrat-led attempts in Florida to overturn a law preventing former felons from voting if they haven't paid all their fines or restitution. That is not necessarily related to mail-in balloting.
Meanwhile, the President's team is fighting to preserve aspects of mail-in voting they hope will offer Trump a strategic advantage."
library(htmltools)
library(tokenizers)
library(quanteda)
b <- tokenize_sentences(text)
trial <- b
buslist <- lapply(
seq_along(trial),
function(x, k){
bus <- withTags(div(id = k,x[k]))
return(bus)},
x = trial)
names(buslist) <- q
getting this error :
`Error in writeImpl(text) :
Text to be written must be a length-one character vector
> `