Skip to content

Commit

Permalink
move RStudio chunk calls from github chapter to rstudio chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
jules32 committed Mar 12, 2018
1 parent d7f34c0 commit 6e7bad6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
31 changes: 1 addition & 30 deletions github.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -404,41 +404,12 @@ output: html_document

# Learning ggplot2

We're learning ggplot.2 It's going to be amazing.
We're learning ggplot2 It's going to be amazing.

```
Now, let's save it. I'm going to call my file `ggplot2.Rmd`.
OK. Now let's practice with some of those commands that we were working on this morning.
Create a new chunk in your RMarkdown first in one of these ways:
- click "Insert > R" at the top of the editor pane
- type by hand
\```{r}
\```
- if you haven't deleted a chunk that came with the new file, edit that one
Now, let's write some R code.
```
library(tidyverse) # install.packages('tidyverse')
```
Now, hitting return does not execute this command; remember, it's just a text file. To execute it, we need to get what we typed in the the R chunk (the grey R code) down into the console. How do we do it? There are several ways (let's do each of them):
1. copy-paste this line into the console.
1. select the line (or simply put the cursor there), and click 'Run'. This is available from
a. the bar above the file (green arrow)
b. the menu bar: Code > Run Selected Line(s)
c. keyboard shortcut: command-return
1. click the green arrow at the right of the code chunk
### Your turn
Add a few more commands to your file from this morning. Execute them by trying the three ways above.
Then, sync your file to GitHub.
What if a file doesn't show up in the Git tab and you expect that it should? Check to make sure you've saved the file. If the filename is red with an asterix, there have been changes since it was saved. Remember to save before syncing to GitHub!
Expand Down
33 changes: 33 additions & 0 deletions rstudio.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,39 @@ Learn more: http://rmarkdown.rstudio.com/
Use the Markdown Quick Reference (in the menu bar: Help > Markdown Quick Reference).
1. Reknit your html file.


### Code chunks

OK. Now let's practice with some of those commands that we were working on this morning.

Create a new chunk in your RMarkdown first in one of these ways:

- click "Insert > R" at the top of the editor pane
- type by hand
\```{r}
\```
- if you haven't deleted a chunk that came with the new file, edit that one

Now, let's write some R code.

```
x <- seq(1:15)
```

Now, hitting return does not execute this command; remember, it's just a text file. To execute it, we need to get what we typed in the the R chunk (the grey R code) down into the console. How do we do it? There are several ways (let's do each of them):

1. copy-paste this line into the console.
1. select the line (or simply put the cursor there), and click 'Run'. This is available from
a. the bar above the file (green arrow)
b. the menu bar: Code > Run Selected Line(s)
c. keyboard shortcut: command-return
1. click the green arrow at the right of the code chunk

### Your turn

Add a few more commands to your file from this morning. Execute them by trying the three ways above. Then, save your R Markdown file.


<!--- remove this stuff and instead set up Git/GitHub.
## Working directory
Expand Down

0 comments on commit 6e7bad6

Please sign in to comment.