solar_system <- dict(Mercury = 0.387, Venus = 0.723, Earth = 1, Mars = 1.524)
for (e in entries(solar_system))
cat('The distance between planet', e$key, ' and the Sun is', e$value, ' AU.\n')
inner_solar_system <- entries(solar_system) %>%
keep(function(e) e$value <= 1) %>%
collect()
Run the code above in your browser using DataLab