为什么我的devtools缺少has_devel()函数?

时间:2017-09-30 23:33:41

标签: r

我正在尝试关注Hadley Wickham's guide to create packages,但在完全遵循他的步骤后我遇到了错误。我知道很多其他人都没有错误,所以我不确定如何继续。

到目前为止,这是我的输入和输出:

> install.packages(c("devtools", "roxygen2", "testthat", "knitr"))
Installing packages into ‘C:/Users/jerem/Documents/R/win-library/3.4’ 
(as ‘lib’ is unspecified)
also installing the dependency ‘git2r’

trying URL     'https://cran.rstudio.com/bin/windows/contrib/3.4/git2r_0.19.0.zip'
Content type 'application/zip' length 3026420 bytes (2.9 MB)
downloaded 2.9 MB

trying URL     'https://cran.rstudio.com/bin/windows/contrib/3.4/devtools_1.13.3.zip'
Content type 'application/zip' length 443739 bytes (433 KB)
downloaded 433 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/roxygen2_6.0.1.zip'
Content type 'application/zip' length 756869 bytes (739 KB)
downloaded 739 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/testthat_1.0.2.zip'
Content type 'application/zip' length 1057803 bytes (1.0 MB)
downloaded 1.0 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/knitr_1.17.zip'
Content type 'application/zip' length 1027379 bytes (1003 KB)
downloaded 1003 KB

package ‘git2r’ successfully unpacked and MD5 sums checked
package ‘devtools’ successfully unpacked and MD5 sums checked
package ‘roxygen2’ successfully unpacked and MD5 sums checked
package ‘testthat’ successfully unpacked and MD5 sums checked
package ‘knitr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\jerem\AppData\Local\Temp\Rtmpeuw2OQ\downloaded_packages


> install.packages("rstudioapi")
Installing package into ‘C:/Users/jerem/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/rstudioapi_0.7.zip'
Content type 'application/zip' length 129765 bytes (126 KB)
downloaded 126 KB

package ‘rstudioapi’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\jerem\AppData\Local\Temp\Rtmpeuw2OQ\downloaded_packages
> rstudioapi::isAvailable("0.99.149")
[1] TRUE
> devtools::install_github("hadley/devtools")
Downloading GitHub repo hadley/devtools@master
from URL https://api.github.com/repos/hadley/devtools/zipball/master
Installing devtools
Downloading GitHub repo rstudio/rstudioapi@master
from URL https://api.github.com/repos/rstudio/rstudioapi/zipball/master
Installing rstudioapi
"C:/PROGRA~1/R/R-34~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/jerem/AppData/Local/Temp/Rtmpeuw2OQ/devtools9c45cf312b/rstudio-rstudioapi-8e8bfb0"  \
  --library="C:/Users/jerem/Documents/R/win-library/3.4" --install-tests 

* installing *source* package 'rstudioapi' ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (rstudioapi)
"C:/PROGRA~1/R/R-34~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/jerem/AppData/Local/Temp/Rtmpeuw2OQ/devtools9c42002296c/hadley-devtools-a0c8d73"  \
  --library="C:/Users/jerem/Documents/R/win-library/3.4" --install-tests 

* installing *source* package 'devtools' ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (devtools)

到目前为止,一切似乎都很顺利,但在这里打破了。

> library(devtools)
Loading required package: usethis
> has_devel()
Error in has_devel() : could not find function "has_devel"

其他信息:

我的路径:

  
    

Sys.getenv( “路径”)

  
[1] "C:\\Program Files\\R\\R-3.4.1\\bin\\x64;c:\\Rtools\\bin;c:\\Rtools\\mingw_32\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Users\\jerem\\AppData\\Local\\Microsoft\\WindowsApps;"

devtools的内容:

  

ls(pos =“package:devtools”)

1“add_path”“as.package”“bash”“build”
  [5]“build_manual”“build_vignettes”“build_win”“check”
  [9]“check_built”“check_cran”“check_dep_version”“check_failures”
 [13]“check_man”“clean_dll”“clean_vignettes”“创建”
 [17]“create_description”“dev_mode”“dev_package_deps”“dev_packages”
 [21]“devtest”“document”“dr_devtools”“dr_github”
 [25]“get_path”“github_pat”“github_pull”“github_release”
 [29]“has_tests”“install”“install_bioc”“install_bitbucket”
 [33]“install_cran”“install_deps”“install_dev_deps”“install_git”
 [37]“install_github”“install_local”“install_svn”“install_url”
 [41]“install_version”“is.package”“lint”“load_all”
 [45]“loaded_pa​​ckages”“missing_s3”“on_path”“package_deps”
 [49]“package_file”“parse_deps”“r_env_vars”“release”
 [53]“release_checks”“reload”“revdep”“revdep_check”
 [57]“revdep_check_print_problems”“revdep_check_reset”“revdep_check_resume”“revdep_check_save_summary”
 [61]“revdep_email”“revdep_maintainers”“rhub_check”“run_examples”
 [65]“session_info”“set_path”“setup”“show_news”
 [69]“source_gist”“source_url”“spell_check”“submit_cran”
 [73]“system_check”“system_output”“test”“uninstall”
 [77]“卸载”“update_packages”“use_appveyor”“use_build_ignore”
 [81]“use_code_of_conduct”“use_coverage”“use_cran_badge”“use_cran_comments”
 [85]“use_data”“use_data_raw”“use_dev_version”“use_git”
 [89]“use_git_hook”“use_github”“use_github_links”“use_gpl3_license”
 [93]“use_mit_license”“use_news_md”“use_package”“use_package_doc”
 [97]“use_rcpp”“use_readme_md”“use_readme_rmd”“use_revdep”
[101]“use_rstudio”“use_test”“use_testthat”“use_travis”
[105]“use_vignette”“uses_testthat”“wd”“with_debug”

我应该更改什么才能使用has_devel函数?

2 个答案:

答案 0 :(得分:0)

尝试通过运行具有管理员权限的RStudio来安装dev_tools

答案 1 :(得分:0)

我有同样的问题。 has_devel()和find_rtools()似乎没有出现在我安装的devtools包中。

所以不要像在Hadley的指示中那样从github安装:

devtools::install_github("hadley/devtools")

我使用以下方法从CRAN安装了devtools:

install.packages("devtools")

之后

devtools::find_rtools()

devtools::has_devel()

成功运行