The flux ratios in the multiple images of gravitationally lensed quasars can provide evidence for dark matter substructure in the halo of the lensing galaxy if the flux ratios differ from those predicted by a smooth model of the lensing galaxy mass distribution. However, it is also possible that baryonic structures in the lensing galaxy, such as edge-on discs, can produce flux-ratio anomalies. In this work, we present the first statistical analysis of flux-ratio anomalies due to baryons from a numerical simulation perspective. We select galaxies with various morphological types in the Illustris simulation and ray-trace through the simulated halos, which include baryons in the main lensing galaxies but exclude any substructures, in order to explore the pure baryonic effects. Our ray-tracing results show that the baryonic components can be a major contribution to the flux-ratio anomalies in lensed quasars and that edge-on disc lenses induce the strongest anomalies. We find that the baryonic components increase the probability of finding high flux-ratio anomalies in the early-type lenses by about 8% and by about 10 - 20% in the disc lenses. The baryonic effects also induce astrometric anomalies in 13% of the mock lenses. Our results indicate that the morphology of the lens galaxy becomes important in the analysis of flux-ratio anomalies when considering the effect of baryons, and that the presence of baryons may also partially explain the discrepancy between the observed (high) anomaly frequency and what is expected due to the presence of subhalos as predicted by the CDM simulations.