How to keep a subsetted value for calculating mean I am currently learning R and I have to solve an Issue were I have to extract values from a data set which are from a specific month and from this values I should calculate the mean Temp. 

I did it like that:

data[data$X..Month.. == 6,]   

mean(data$X..Temp.., na.rm=TRUE)

It gave me the mean value but without taking my first statement into consideration. 
What do I need to do that both statements are taken into consideration?
You can answer this using tapply, which will give you the mean for all your subsets, e.g.

dummy data

df = data.frame(mon=rep(month.abb, times=10)


calculate mean for all months

tapply(df$temp, df$mon, mean, na.rm=T)