Skip to content

Commit

Permalink
Add solutions to subsetting challenge (see #427)
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinleinweber committed May 13, 2019
1 parent 4f5e8aa commit 3a37e7b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _episodes_rmd/01-starting-with-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ We'll learn why this is so in the next lesson.
> explain what `animal[-1:-4]` does.
>
> 1. Use a slice of `animal` to create a new character vector that spells the word "eon", i.e. `c("e", "o", "n")`.
> > ## Solutions
> >
> > 1. `animal[4:1]`
> >
> > 1. `"o" "n" "k" "e" "y"` and `"m" "o" "n" "e" "y"`, which means that a
> > single `-` removes the element at the given index position.
> > `animal[-1:-4]` remove the slice, returning `"e" "y"`, which is
> > equivalent to `animal[5:6]`.
> >
> {: .solution}
{: .challenge}

> ## Subsetting More Data
Expand Down

0 comments on commit 3a37e7b

Please sign in to comment.