You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
text <-<spanclass="st"></span><spanclass="kw">c</span>(<spanclass="st">"ace"</span>, <spanclass="st">"hearts"</span>)</code></pre>
390
390
<p>You may wonder why R uses multiple types of vectors. Vector types help R behave as you would expect. For example, R will do math with atomic vectors that contain numbers, but not with atomic vectors that contain character strings:</p>
<p>In <ahref="r-objects.html#attributes">Attributes</a>, you learned that many R objects come with attributes, pieces of extra information that are given a name and appended to the object. Attributes do not affect the values of the object, but stick to the object as a type of metadata that R can use to handle the object. For example, a data frame stores its row and column names as attributes. Data frames also store their class, <code>"data.frame"</code>, as an attribute.</p>
370
-
<p>You can see an object’s attributes with <code>attribute</code>. If you run <code>attribute</code> on the <code>DECK</code> data frame that you created in <ahref="project-2-playing-cards.html#project-2-playing-cards">Project 2: Playing Cards</a>, you will see:</p>
<p>You can see an object’s attributes with <code>attribute</code>. If you run <code>attribute</code> on the <code>deck</code> data frame that you created in <ahref="project-2-playing-cards.html#project-2-playing-cards">Project 2: Playing Cards</a>, you will see:</p>
<p>R comes with many helper functions that let you set and access the most common attributes used in R. You’ve already met the <code>names</code>, <code>dim</code>, and <code>class</code> functions, which each work with an eponymously named attribute. However, R also has <code>row.names</code>, <code>levels</code>, and many other attribute-based helper functions. You can use any of these functions to retrieve an attribute’s value:</p>
0 commit comments