简体   繁体   English

如何在R中安装软件包

[英]How to install package in R

I want to install package in R : nloptr , seriation , pbkrtest , NbClust , cluster , car , scales , fpc , mclust , apcluster , vegan to use it on my powerbi for k means clustering. 我想在R键安装包: nloptrseriationpbkrtestNbClustclustercarscalesfpcmclustapclustervegan把它用在我的powerbi对于k均值聚类。

I already install R 3.3.1 in my windows. 我已经在Windows中安装了R 3.3.1。 I open my R like this: 我像这样打开我的R:

R命令提示符

I already tried use two commands to install packages like this: 我已经尝试使用两个命令来安装这样的软件包:

install.packages("D:/Skripsi/PowerBI-visuals-clustering-kmeans-master.zip', lib='C:/Program Files/R/R-3.3.1',repos = NULL)

install.packages.zip("D:/Skripsi/PowerBI-visuals-clustering-kmeans-master.zip", repos = NULL)

but I get an error 但我得到一个错误

no function install.package.zip or no such file. 没有功能install.package.zip或没有这样的文件。

my package location : D:\\Skripsi\\PowerBI-visuals-clustering-kmeans-master 我的包裹位置: D:\\Skripsi\\PowerBI-visuals-clustering-kmeans-master

I want to use this package : https://github.com/Microsoft/PowerBI-visuals-clustering-kmeans or do I have to install one by one and how to install package in R? 我想使用此软件包: https : //github.com/Microsoft/PowerBI-visuals-clustering-kmeans还是我必须一一安装,以及如何在R中安装软件包? Thank you 谢谢

The repository on GitHub you link to is not in the valid R package structure and thus not installable as such. 您链接到的GitHub上的存储库不在有效的R包结构中,因此无法如此安装。 You are best downloading the files, extracting them locally and sourcing (using function source , see help("source") ) any R scripts you may want to use. 你最好是下载文件,在本地提取它们和采购(使用函数source ,请参阅help("source")您可能希望使用任何脚本[R。

As for the rest, there is no function called install.packages.zip that would come with base R installation. 至于其余部分,没有安装R的基本功能,即install.packages.zip When I install packages from local zip files (rarely, though), I use 当我从本地zip文件安装软件包时(虽然很少),我使用

install.packages("/path/to/zipfile.zip", repos = NULL) 

and it appears to work fine. 它似乎工作正常。 As already said, this won't work for your "PowerBI-visuals-clustering-kmeans-master.zip". 如前所述,这对您的“ PowerBI-visuals-clustering-kmeans-master.zip”不起作用。

To install the packages you mention, you should do something along the lines of 要安装您提到的软件包,您应该按照以下步骤进行操作:

install.packages(c("nloptr", "seriation", "pbkrtest", "NbClust", "cluster", "car", "scales", "fpc", "mclust", "apcluster", "vegan"))

If it is a " normal " package: 如果是“ 常规 ”软件包:

install.packages("NAME_OF_YOUR_PACKAGE")

It it is a " bioconductor " package: 它是一个“ 生物导体 ”包装:

source("https://bioconductor.org/biocLite.R")
biocLite(NAME_OF_YOUR_PACKAGE)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM