We analyze the high-energy neutrino events observed by IceCube, aiming to probe the initial flavor of cosmic neutrinos. We study the track-to-shower ratio of the subset with energy above 60 TeV, where the signal is expected to dominate, and show that different production mechanisms give rise to different predictions even accounting for the uncertainties due to neutrino oscillations. We include for the first time the passing muons observed by IceCube in the analysis. They corroborate the hypotheses that cosmic neutrinos have been seen and their flavor matches expectations derived from the neutrino oscillations.