How to use GPT for text analysis in R

A brief tutorial on how to use GPT, the LLM underlying the artificial intelligence chatbot ChatGPT, to analyze psychological constructs (such as sentiment and emotions) in R. For sample code to follow along with this tutorial, check out the supplementary materials of the following paper: Rathje, S., Mirea, D., Sucholutsky, I., Marjieh, R., Robertson, C., & Van Bavel, J. J. (2024). GPT is an effective tool for multilingual psychological text analysis. Proceedings of the National Academy of Sciences, 121(34). https://doi.org/10.1073/pnas.2308950121.