Actually it's the fourth text which is the longest, once we remove the padding from whitespace. Here's how. Note that a lot of this comes from the difficulty of getting texts out of a tm (V)Corpus object, which has been asked (several times) before, for instance here.
Note that I am interpreting your question about "lines" as referring to the five documents, which are more than five lines each, but consist of multiple lines (between 16 and 18 length character vectors each). I hope I have interpreted this correctly.
texts <- sapply(ovid$content, "[[", "content")
str(texts)
## List of 5
## $ : chr [1:16] " Si quis in hoc artem populo non novit amandi," " hoc legat et lecto carmine doctus amet." " arte citae veloque rates remoque moventur," " arte leves currus: arte regendus amor." ...
## $ : chr [1:17] " quas Hector sensurus erat, poscente magistro" " verberibus iussas praebuit ille manus." " Aeacidae Chiron, ego sum praeceptor Amoris:" " saevus uterque puer, natus uterque dea." ...
## $ : chr [1:17] " vera canam: coeptis, mater Amoris, ades!" " este procul, vittae tenues, insigne pudoris," " quaeque tegis medios, instita longa, pedes." " nos venerem tutam concessaque furta canemus," ...
## $ : chr [1:17] " scit bene venator, cervis ubi retia tendat," " scit bene, qua frendens valle moretur aper;" " aucupibus noti frutices; qui sustinet hamos," " novit quae multo pisce natentur aquae:" ...
## $ : chr [1:18] " mater in Aeneae constitit urbe sui." " seu caperis primis et adhuc crescentibus annis," " ante oculos veniet vera puella tuos:" " sive cupis iuvenem, iuvenes tibi mille placebunt." ...
So here we have extracted the texts, but they are on multiple lines represented by one element each of the character vectors that each "document" comprises, and because they are verses, there is variable white space padding at the beginning and end of some of these elements. Let's trim these and just leave the text, using stringi's stri_trim_both
function.
# need to trim leading and trailing whitespace
texts <- lapply(texts, stringi::stri_trim_both)
## texts[1]
## [[1]]
## [1] "Si quis in hoc artem populo non novit amandi," "hoc legat et lecto carmine doctus amet."
## [3] "arte citae veloque rates remoque moventur," "arte leves currus: arte regendus amor."
## [5] "" "curribus Automedon lentisque erat aptus habenis,"
## [7] "Tiphys in Haemonia puppe magister erat:" "me Venus artificem tenero praefecit Amori;"
## [9] "Tiphys et Automedon dicar Amoris ego." "ille quidem ferus est et qui mihi saepe repugnet:"
## [11] "" "sed puer est, aetas mollis et apta regi."
## [13] "Phillyrides puerum cithara perfecit Achillem," "atque animos placida contudit arte feros."
## [15] "qui totiens socios, totiens exterruit hostes," "creditur annosum pertimuisse senem."
# now paste them together to make a single character vector of the five documents
texts <- sapply(texts, paste, collapse = "\n")
str(texts)
## chr [1:5] "Si quis in hoc artem populo non novit amandi,\nhoc legat et lecto carmine doctus amet.\narte citae veloque rates remoque movent"| __truncated__ ...
cat(texts[1])
## Si quis in hoc artem populo non novit amandi,
## hoc legat et lecto carmine doctus amet.
## arte citae veloque rates remoque moventur,
## arte leves currus: arte regendus amor.
##
## curribus Automedon lentisque erat aptus habenis,
## Tiphys in Haemonia puppe magister erat:
## me Venus artificem tenero praefecit Amori;
## Tiphys et Automedon dicar Amoris ego.
## ille quidem ferus est et qui mihi saepe repugnet:
##
## sed puer est, aetas mollis et apta regi.
## Phillyrides puerum cithara perfecit Achillem,
## atque animos placida contudit arte feros.
## qui totiens socios, totiens exterruit hostes,
## creditur annosum pertimuisse senem.
That's looking more like it. Now we can figure out which was longest.
nchar(texts)
## [1] 600 621 644 668 622
which.max(nchar(texts))
## [1] 4