我使用的是Win64,无法在R上安装'闪亮'软件包。尝试安装时,会填充以下消息。有人可以把我放在正确的轨道上,还是我错过了一些真正愚蠢的东西?
> 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)
我尝试使用India,Cloud(0)作为CRAN镜像
ui.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")
)
))
server.R文件的内容:
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 :(得分:12)
尝试:
options(repos = c(CRAN = "http://cran.rstudio.com"))
install.packages('shiny')
答案 1 :(得分:-2)
停止防火墙和防病毒软件,然后安装软件包。它对我有用