Translation issue with dative relative pronoun

Hi all! I’ve just started learning Greek recently and I’ve been trying to go through some translation exercises on my own, but I am really struggling with this sentence.

ἡ ναῦς, ἐν ᾗ ἔπλει, τεττάρων ἡμερῶν εἰς τὸν λιμένα ἀφίκετο.

I want to understand what ἐν ᾗ in dative is agreeing with — would ἐν ᾗ ἔπλει translate to something like “which was sailing for” or is there a subject I am missing? The entire translation of the sentence is confusing for me, and I’d love to understand how it works grammatically.

εν ηι επλει is a relative clause. The antecedent of the relative pronoun ηι is η ναυς, so ηι is feminine singular, but within the relative clause ηι functions as the object of the preposition εν, so it’s in the dative case.

The subject of the relative clause is understood from the verb επλει, a third person singular pronoun, he or she, since επλει is third person singular. Greek does not need to express the subject of a verb when the subject would be a personal pronoun because the subject is always implicit in the ending of the verb. So personal pronoun subjects are often omitted, unless there is a special reason for them, such as emphasis or clarity.

εν ηι επλει – “in which s/he sailed”

(I think the verb πλεω would generally have a human subject if referring to the occupant of a ship, so “it” can be ruled out here, but with other verbs, depending on meaning, an understood third person subject could be a non-human subject, it.)