Patrick J. Hartin, James, Sacra Pagina (Collegeville, MN: Liturgical Press, 2009), 67:
The root cause of unanswered prayer is the human person’s lack of faith in God. The result is a divided allegiance. This theme of divided loyalty runs throughout the letter [of James] and culminates in 4:4 with the dramatic choice between friendship with the world and friendship with God. James graphically illustrates the fickleness of the divided person with the image of the wind-tossed sea, its waves driven backward and forward (1:6). The double-minded…(1:18) are so filled with uncertainty and indecision that they are unable to choose between the alternatives, namely whether to trust in God or not. This is similar to the Jesus saying in the Sermon on the Mount: “No one can serve two masters; for a slave will either hate the one and love the other, or be devoted to the one and despise the other. You cannot serve God and wealth” (Matt 6:24).