gpt4 book ai didi

r - 无法在 R 3.0.2 上安装包 Shiny

转载 作者:行者123 更新时间:2023-12-01 08:29:56 25 4
gpt4 key购买 nike

我正在使用 Win64 并且无法在 R 上安装“ Shiny ”包。尝试安装时,会填充以下消息。有人可以把我放在正确的轨道上还是我在这里错过了一些非常愚蠢的东西?

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

这两个问题有关系吗?

最佳答案

试试:

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

关于r - 无法在 R 3.0.2 上安装包 Shiny ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21595822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com