2014-02-06 27 views
3

我正在使用Win64,无法在R上安装'闪亮'包。尝试安装时,会填充以下消息。有人能让我走上正轨吗?还是我错过了一些真正愚蠢的东西?无法在R 3.0.2上安装包闪亮

> install.packages("shiny") 
Installing package into ‘C:/Users/Ayan/Documents/R/win-library/3.0’ 
(as ‘lib’ is unspecified) 
--- Please select a CRAN mirror for use in this session --- 
Warning: unable to access index for repository http://ftp.iitm.ac.in/cran/bin/windows/contrib/3.0 
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.0 
Warning messages: 
1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org' 
2: package ‘shiny’ is not available (for R version 3.0.2) 

我尝试使用印度,云(0)作为CRAN镜像ui.R文件的

内容:server.R文件的

library(shiny) 

# Define UI for application that plots random distributions 
shinyUI(pageWithSidebar(

# Application title 
headerPanel("Hello Shiny!"), 

    # Sidebar with a slider input for number of observations 
    sidebarPanel(
    sliderInput("obs", 
      "Number of observations:", 
      min = 1, 
      max = 1000, 
      value = 500) 
), 

    # Show a plot of the generated distribution 
    mainPanel(
    plotOutput("distPlot") 
) 
)) 

内容:

library(shiny) 

    # Define server logic required to generate and plot a random distribution 
shinyServer(function(input, output) { 

    # Expression that generates a plot of the distribution. The expression 
    # is wrapped in a call to renderPlot to indicate that: 
    # 
    # 1) It is "reactive" and therefore should be automatically 
    #  re-executed when inputs change 
    # 2) Its output type is a plot 
    # 
    output$distPlot <- renderPlot({ 

    # generate an rnorm distribution and plot it 
     dist <- rnorm(input$obs) 
     hist(dist) 
     }) 
    }) 

另外我还遇到了安装包'holdOut'出现分类问题的问题。这是它显示的内容:

> install.packages("holdOut") 
Installing package into ‘C:/Users/Ayan/Documents/R/win-library/3.0’ 
(as ‘lib’ is unspecified) 
Warning in install.packages : 
    package ‘holdOut’ is not available (for R version 3.0.2) 

这两个问题有关吗?

+0

好的......已经设法安装软件包,但我陷入了下一个阶段。这就是我所做的:1.在我的Documents文件夹中创建了一个名为“shinytest”的文件夹,该文件夹是我的工作目录R 2.然后在它们中都有R文件ui.R和server.R。当我输入: – Ayan

+0

>库(闪亮),然后> runApp(“shinytest”)R突然退出。任何想法? – Ayan

+0

没有代码...不知道。 ui.R文件的内容 – Vincent

回答

12

尝试:

options(repos = c(CRAN = "http://cran.rstudio.com")) 
install.packages('shiny') 
+2

'install.packages'也有一个'repos'参数,可以直接使用,无需修改选项 –

+0

yes,i已经管理该部分,欣赏它 – Ayan

-2

只要停止您的防火墙和杀毒软件,然后安装软件包。它为我工作

+1

因为它适用于您并不意味着操作系统防火墙和防病毒软件正在干扰。 – ppperry

+0

不是一个普遍的答案 – Outlier