More about upgrades and running code
This commit is contained in:
parent
30509621cf
commit
6a4c1c9270
25
intro.Rmd
25
intro.Rmd
|
@ -101,9 +101,11 @@ There are four things you need to run the code in this book: R, RStudio, a colle
|
|||
|
||||
To download R, go to CRAN, the **comprehensive** **R** **a**rchive **network**. CRAN is composed of a set of mirror servers distributed around the world and is used to distribute R and R packages. Don't try and pick a mirror that's close to you: instead use the cloud mirror, <https://cloud.r-project.org>, which automatically figures it out for you.
|
||||
|
||||
A new major version of R comes out once a year, and there are 2-3 minor releases each year. It's a good idea to update regularly. Upgrading can be a bit of a hassle, especially for major versions, which require you to reinstall all your packages, but putting it off only make it worse.
|
||||
|
||||
### RStudio
|
||||
|
||||
RStudio is an integrated development environment, or IDE, for R programming. Download and install it from <http://www.rstudio.com/download>.
|
||||
RStudio is an integrated development environment, or IDE, for R programming. Download and install it from <http://www.rstudio.com/download>. RStudio is updated a couple of times a year. When a new version is available, RStudio will let you know. It's a good idea to upgrade regularly so you can take advantage of the latest and greatest features.
|
||||
|
||||
When you start RStudio, you'll see two key regions in the interface:
|
||||
|
||||
|
@ -133,6 +135,8 @@ library(tidyverse)
|
|||
|
||||
This tells you that tidyverse is loading the ggplot2, tibble, tidyr, readr, purrr, and dplyr packages. These are considered to be the __core__ of the tidyverse because you'll use them in almost every analysis.
|
||||
|
||||
Packages in the tidyverse change fairly frequently. You can see if updates are available, and optionally install them, by running `tidyverse_update()`.
|
||||
|
||||
### Other packages
|
||||
|
||||
There are many other excellent packages that are not part of the tidyverse, because they solve problems in a different domain, are or designed with a different set of underlying principles. This doesn't make them better or worse, just different. In other words, the complement to the tidyverse is not the messyverse, but many other universes of interrelated packages. As you tackle more data science projects with R, you'll learn new packages and new ways of thinking about data.
|
||||
|
@ -145,7 +149,24 @@ install.packages(c("nycflights13", "gapminder", "Lahman"))
|
|||
|
||||
These packages provide data on airline flights, world development, and baseball that we'll use to illustrate key data science ideas.
|
||||
|
||||
## Code conventions
|
||||
## Running R code
|
||||
|
||||
The previous section showed you a couple of examples of running R code. Code in the book looks like this:
|
||||
|
||||
```{r, eval = TRUE}
|
||||
1 + 2
|
||||
#> [1] 3
|
||||
```
|
||||
|
||||
If you run the same code in you're console, it will look like this:
|
||||
|
||||
```
|
||||
# In your R console
|
||||
> 1 + 2
|
||||
[1] 3
|
||||
```
|
||||
|
||||
In your console, input starts at `>`, called the __prompt__. In the book, output is commented out with `#>`. Together, these differences mean that if you're working with an electronic version of the book, you can easily copy code out of the book and into the console.
|
||||
|
||||
Throughout the book we use a consistent set of conventions to refer to code:
|
||||
|
||||
|
|
Loading…
Reference in New Issue