class='no'>group</span>)
<span class='no'>elements</span>$<span class='no'>period</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/character.html'>as.character</a></span>(<span class='no'>elements</span>$<span class='no'>period</span>)

<span class='co'># add colors for groups</span>
<span class='no'>metals</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"alkali metal"</span>, <span class='st'>"a