简体   繁体   中英

Unable to install package shiny on R 3.0.2

I am using Win64 and am unable to install the 'shiny' package on R. When trying to install, the following message is populated. Can someone please put me in the right track or am I missing something really stupid here?

> 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)

I tried using India, Cloud(0) as the CRAN mirror

contents of ui.R file:

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")
  )
))

contents of server.R file:

    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)
      })
    })

Also I was facing problem installing the package 'holdOut' for classification problem. This is what it shows:

> 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)

Are these 2 problems related?

Try:

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

Just stop your firewall and antivirus and then installing the package. It worked for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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