想安装github的数据进行学习,结果总是安装失败。
国家:中国
系统: Win7 64位
R : 3.5.0
RStudio: Version 1.1.463,
百度搜索一下,发现问题原因是github被墙了,可通过修改host解决。
Step1: 在站长之家(http://tool.chinaz.com/dns/)查询最优的DNS
并在host 中修改,修改前,先ping 一下,选择响应速度最快的DNS地址。
修改C:\Windows\System32\drivers\etc文件夹中的 host 文件,在文件末尾加入以下语句。
192.30.255.113 github.com
192.30.255.116 api.github.com
网站打开速度,及 ping api.github.com 均有响应,不再超时,但还是安装出错,错误如下。
install_github("hadley/nycflights13")
Downloading GitHub repo hadley/nycflights13@master
Error in untar2(tarfile, files, list, exdir) : incomplete block on file
Step2: 还是修改host
手动下载github包的连接是(https://github.com/hadley/nycflights13.git)
但到了下载器里,连接地址变成了(https://codeload.github.com/hadley/nycflights13/zip/master)
重新再站长之家(http://tool.chinaz.com/dns/) 输入(codeload.github.com)查询
找TTL 较小的DNS 地址,在CMD 中运行 ping 命令,选择最小延迟的DNS,添加到host文件,并保存。例如:
192.30.253.121 codeload.github.com
> install_github("hadley/nycflights13")
Downloading GitHub repo hadley/nycflights13@master
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.5 from http://cran.r-project.org/bin/windows/Rtools/.
√ checking for file 'C:\Users\Administrator.SC-201606130856\AppData\Local\Temp\RtmpeqZUrp\remotes147059304978\hadley-nycflights13-2881410/DESCRIPTION' (577ms)
- preparing 'nycflights13':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- looking to see if a 'data/datalist' file should be added
- building 'nycflights13_1.0.0.9000.tar.gz' (4.2s)
* installing *source* package 'nycflights13' ...
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'nycflights13'
finding HTML links ... 好了
airlines html
airports html
flights html
planes html
weather html
** building package indices
** testing if installed package can be loaded
* DONE (nycflights13)
In R CMD INSTALL
Warning messages:
1: In if (!base.OK && isBaseNamespace(ns)) stop("operation not allowed on base namespace") else ns :
closing unused connection 4 (hadley-nycflights13-2881410/data-raw/airports.dat)
2: In untar2(tarfile, files, list, exdir) :
skipping pax global extended headers
3: In untar2(tarfile, files, list, exdir) :
skipping pax global extended headers
library(nycflights13)
flights
# A tibble: 336,776 x 19
year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time arr_delay carrier flight
<int> <int> <int> <int> <int> <dbl> <int> <int> <dbl> <chr> <int>
1 2013 1 1 517 515 2 830 819 11 UA 1545
2 2013 1 1 533 529 4 850 830 20 UA 1714
3 2013 1 1 542 540 2 923 850 33 AA 1141
4 2013 1 1 544 545 -1 1004 1022 -18 B6 725
5 2013 1 1 554 600 -6 812 837 -25 DL 461
6 2013 1 1 554 558 -4 740 728 12 UA 1696
7 2013 1 1 555 600 -5 913 854 19 B6 507
8 2013 1 1 557 600 -3 709 723 -14 EV 5708
9 2013 1 1 557 600 -3 838 846 -8 B6 79
10 2013 1 1 558 600 -2 753 745 8 AA 301
# ... with 336,766 more rows, and 8 more variables: tailnum <chr>, origin <chr>, dest <chr>,
# air_time <dbl>, distance <dbl>, hour <dbl>, minute <dbl>, time_hour <dttm>
问题总结: