tidyverse / modelr

Helper functions for modelling
https://modelr.tidyverse.org
GNU General Public License v3.0
401 stars 65 forks source link

how do you import the sim1 data? #39

Closed paynito closed 6 years ago

paynito commented 7 years ago

Hi Hadley, I'm having trouble in section 23 "modeling" of R for Data Science The sim1 dataset you use in your examples isn't loading for me.

library(tidyverse)
library(modelr)    
# options(na.action = na.warn)
download.file("https://github.com/hadley/modelr/blob/master/data/sim1.rda", "sim1.rda")
#sim1 <- readRDS("sim1.rda")
load("sim1.rda")
install.packages(c("nycflights13", "gapminder", "Lahman"))
ggplot(sim1, aes(x,y))+
  geom_point()

> load("sim1.rda")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘sim1.rda’ has magic number '<'
Use of save versions prior to 2 is deprecated 

Error in ggplot(sim1, aes(x, y)) : object 'sim1' not foun
hadley commented 6 years ago

It's included in the package

library(modelr)
sim1
#> # A tibble: 30 x 2
#>        x     y
#>    <int> <dbl>
#>  1     1  4.20
#>  2     1  7.51
#>  3     1  2.13
#>  4     2  8.99
#>  5     2 10.2 
#>  6     2 11.3 
#>  7     3  7.36
#>  8     3 10.5 
#>  9     3 10.5 
#> 10     4 12.4 
#> # ... with 20 more rows

Created on 2018-05-10 by the reprex package (v0.2.0).