2017-07-27 2 views
1

私はshinyパッケージをインストールするだけの前提条件でrunGitHubを使ってみんなが動くようにしたいという光沢のあるアプリを持っています。Shinyアプリに必要なパッケージをインストール

person'sコンピュータに、彼はプログラムを実行する最初の時間をインストールしてロードするためにすべての必要なパッケージのためには、server.Rでの私のコードで始まる:

それでも
if (!require("pacman")) install.packages("pacman") 
pacman::p_load("maptools","dplyr","data.table","reshape2","ggplot2","plyr","rgdal","rgeos","shinyjs","scales","DT","readxl") 

library(maptools) 
library(dplyr) 
library(data.table) 
library(reshape2) 
library(ggplot2) 
library(plyr) 
library(rgdal) 
library(rgeos) 
library(shinyjs) 
library(scales) 
library(DT) 
library(readxl) 

、私はちょうどよそのPCでそれをテストし、次のエラーが現れる:私は手動でshinyjsをインストールした後

Error in library(shinyjs) : there is no package called ‘shinyjs’ 

、次のように現れた:

Warning: Error in library: there is no package called ‘maptools’ 
Stack trace (innermost first): 
46: library 
45: eval [helper.R#1] 
44: eval 
43: withVisible 
42: source 
3: runApp 
2: runUrl 
1: runGitHub 
Error in library(maptools) : there is no package called ‘maptools’ 

など。これは私の最初の光沢のあるアプリなので、私はこれを達成するはずです。私の完全なコードを実行することによってアクセスすることができます。

runGitHub("Mapas_BBVA_municipios","IArchondo",display.mode="showcase") 

答えて

2

packagesがとても依存関係を持つすべてのパッケージをインストールする必要が、それに沿っていくつかのdependenciesを持っているかもしれないという可能性があります。新しいユーザーごとにこれを解決するには、このようなチェックとインストールを(必要に応じて)実行できます。

#list of packages required 
list.of.packages <- ("pacman","maptools","dplyr","data.table","reshape2","ggplot2","plyr","rgdal","rgeos","shinyjs","scales","DT","readxl") 

#checking missing packages from list 
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] 

#install missing ones 
if(length(new.packages)) install.packages(new.packages, dependencies = TRUE) 

希望します。

0

これが私の作品:

list_of_packages = c("ggplot2","pacman") 

lapply(list_of_packages, 
     function(x) if(!require(x,character.only = TRUE)) install.packages(x)) 
関連する問題