How do I replace x with another letter for example "g" ?
I got a similar question from exercise no. 4.5 in "The book of R " by Tilman M daviies.
I was using this to learn R and could not find a solution to the question.
lapply applies a function over each element of a list. So, here the anonymous function passed to FUN is applied to both a and b of mylist.
Since you specifically asked for gsub, I guess you already know what it does. I used the extra fixed argument as I was searching for literal match instead of a regular expression.
apply family of functions are very useful. I think it is worth reading the documentation and experimenting with these yourself.