Spike-timing dependent plasticity in a transistor-selected resistive switching memory