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
Copy file name to clipboardexpand all lines: s3.rmd
+9-9
Original file line number
Diff line number
Diff line change
@@ -56,10 +56,10 @@ R's S3 system is built around three components: attributes (especially the `clas
56
56
57
57
In [Attributes](#attributes), 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, `"data.frame"`, as an attribute.
58
58
59
-
You can see an object's attributes with `attribute`. If you run `attribute` on the `DECK` data frame that you created in [Project 2: Playing Cards], you will see:
59
+
You can see an object's attributes with `attribute`. If you run `attribute` on the `deck` data frame that you created in [Project 2: Playing Cards], you will see:
60
60
61
61
```r
62
-
attributes(DECK)
62
+
attributes(deck)
63
63
## $names
64
64
## [1] "face" "suit" "value"
65
65
##
@@ -75,7 +75,7 @@ attributes(DECK)
75
75
R comes with many helper functions that let you set and access the most common attributes used in R. You've already met the `names`, `dim`, and `class` functions, which each work with an eponymously named attribute. However, R also has `row.names`, `levels`, and many other attribute-based helper functions. You can use any of these functions to retrieve an attribute's value:
0 commit comments