How to calculate information gain of data during random forest

random_forest

#1

I was currently studying about the random forest and while studying random forest I came across that for creating tree it is necessary to collect information gain of data to split the data in node but I am facing a problem how to calculate the information gain in R .