Self-learning of programming in R can be enjoyable or horribly painful, depending on which type of resource is used. I suggest two books if you are interested in learning R and use it for research in linguistics. Of course, this list is by no means exhaustive and may vary according to personal preferences.
For total beginners, I recommend R for Excel users. This short (very important!) book introduces in a simple and concise way the basic functions of R. It is ideal if you want to do a trial run on R to see if you like it or not but do not want to invest too much time. The title mentions Excel, but you do not need to be proficient in Excel (or to have used Excel before) to understand the content. Linguistic topics are not present in this book, but the analyses relate to the same type of data that linguists use in their research. You may even communicate with the author to ask a few questions or provide some comments!
For intermediate learners, I recommend How to do linguistics with R. This book teaches the reader methods that are specifically relevant to the field of linguistics by using linguistic data. Readers can thus learn the code and run their own analysis just by replacing the input data. Every step of analysis is described in details and the expected output of every code is displayed in figures, which help the reader to check if the code has been written correctly. You are also encouraged to contact the author for comments or questions!