0

I am trying to compute the readability of a variable containing sentences text however when I run the code

read_listing <- qdap::flesch_kincaid(tweets$text, grouping.var = tweets$tweet_id)

I get the error

Error in exists(x2, envir = env) : invalid first argument
In addition: Warning message:
In qdap::flesch_kincaid(tweets$text, grouping.var = tweets$tweet_id) :
The following rows contained empty sentences and were removed:
6517, 6518, 6519, 6520, 7755, 7759, 7779, 7785, 8747, 13522, 16001, 16010, 16013, 
16025, 16027, 16029, 16047, 16050, 16051, 16056, 16065, 16082, 1 [... truncated]

I searched around a bit and found

read_listing <- qdap::flesch_kincaid(gsub("[^ -~]", "", tweets$text), grouping.var = tweets$tweet_id)

But this gives error

Error in syllable_count(Trim(x))[["syllables"]] : subscript out of bounds
In addition: Warning message:
In qdap::flesch_kincaid(gsub("[^ -~]", "", tweets$text), grouping.var = tweets$tweet_id) :
The following rows contained empty sentences and were removed:
6517, 6518, 6519, 6520, 7755, 7759, 7779, 7785, 8747, 13522, 16001, 16010, 16013, 
16022, 16025, 16027, 16029, 16047, 16050, 16051, 16056, 16065, 16082, 16084, 16087,  
16088, 16098, 16103, 16104, 16108, 16112, 16118, 16121, 16128, 16132, 16134, 16136,  
16798, 16800, 1 [... truncated]

What am I doing wrong?

  • It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick May 09 '22 at 14:30

0 Answers0