Skip to content

Commit

Permalink
Typos & Grammar (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarHer90 committed Mar 19, 2023
1 parent f4f5311 commit 96470ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R6.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Side-effect R6 methods should always return `self` invisibly. This returns the "
x$add(10)$add(10)$sum
```

For, readability, you might put one method call on each line:
For readability, you might put one method call on each line:

```{r}
x$
Expand All @@ -145,7 +145,7 @@ This technique is called __method chaining__ and is commonly used in languages l

There are two important methods that should be defined for most classes: `$initialize()` and `$print()`. They're not required, but providing them will make your class easier to use.

`$initialize()` overrides the default behaviour of `$new()`. For example, the following code defines an Person class with fields `$name` and `$age`. To ensure that that `$name` is always a single string, and `$age` is always a single number, I placed checks in `$initialize()`.
`$initialize()` overrides the default behaviour of `$new()`. For example, the following code defines a Person class with fields `$name` and `$age`. To ensure that `$name` is always a single string, and `$age` is always a single number, I placed checks in `$initialize()`.

```{r, error = TRUE}
Person <- R6Class("Person", list(
Expand Down

0 comments on commit 96470ba

Please sign in to comment.