相关疑难解决方法(0)

参数的长度为零

我正在尝试使用以下语法从George Clooney的维基百科页面获取职业信息.最终我希望有一个循环来获取各种人格职业的数据.

但是,运行以下代码时出现以下问题:

Error in if (symbol != "role") symbol = NULL : argument is of length zero
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会继续这样.

library(XML)
library(plyr)
  url = 'http://en.wikipedia.org/wiki/George_Clooney'  

# don't forget to parse the HTML, doh!
  doc = htmlParse(url)  

# get every link in a table cell:
  links = getNodeSet(doc, '//table/tr/td') 

# make a data.frame for each node with non-blank text, link, and 'title' attribute:
  df = ldply(links, function(x) {
                text = xmlValue(x)
            if (text=='') text=NULL
         symbol = xmlGetAttr(x, 'class')
         if (symbol!='role') symbol=NULL
         if(!is.null(text) …
Run Code Online (Sandbox Code Playgroud)

r

17
推荐指数
1
解决办法
8万
查看次数

什么是"类型'闭包的对象'不是子集"错误的闪亮?

我有一个闪亮的应用程序,当我运行它时,我得到一个错误说,一个object of type ‘closure’ is not subsettable.那是什么,我该如何解决?

注意:我写了这个问题,因为这出现了很多,而且可能的欺骗要么不shiny相关,要么不具体,以至于答案广泛适用并不明显.

r shiny

11
推荐指数
1
解决办法
5万
查看次数

'closure'类型的错误对象不是子集表

我有一个程序的问题R.我编写了这段代码,当我想继续它时,我得到错误信息:

daten.asset [[s]]中的错误:'closure'类型的对象不是子表.

我对编程很不了解,有时也很难挣扎.有谁能够帮我?

谢谢你的任何尝试.

我的代码:

r.M.ZR <- arima.sim(model=list(ar=0.6), n = 1100) ;
r.M <-as.vector(r.M.ZR,mode="numeric" );
tilde.r.M <- r.M - mean(r.M)
M <- matrix(c(tilde.r.M, tilde.r.M),2,1100)

A=matrix(c(0.5,0,0,0.5),2,2)

X <- c(0,rnorm(1400, 0, 0.5))           
Y <- c(0,rnorm(1400, 0, 0.5))

Zeta=matrix(0,2,1401)     
Zeta[1,]=X
Zeta[2,]=Y                         

epsilon=matrix(0,2,1401)
epsilon[,1]=0                    

for (i in 2:1401){
  epsilon[,i]=A%*%epsilon[,i-1] + Zeta[,i]
}

epsilon=epsilon[,302:1401]          
alpha <- vector(mode="numeric", length= 1100)
beta <- rep(1, 1100)


daten.asset<-function(){
  da<-vector(mode="list",length=s);
  for (s in 1:2500) {  
  r.i1.ZR <- alpha + beta %*% r.iM[,1] + epsilon;
  r.i1 <-as.vector(r.i1.ZR,mode="numeric" );
  r.i2.ZR<- alpha …
Run Code Online (Sandbox Code Playgroud)

closures runtime-error r

6
推荐指数
1
解决办法
7万
查看次数

ggplot2'闭包'类型的条形图对象不是子集

我正在使用我在这里的数据.

我总结了数据,然后想用它来绘制条形图.

这是我的代码:

heights<-read.csv("reading_anthesis.csv",as.is=T)
str(heights)
##DATA SUMMARY##
##code for data summary from 
## http://www.cookbook-r.com/Manipulating_data/Summarizing_data/
##    data: a data frame.
##   measurevar: the name of a column that contains the variable to be summariezed
##   groupvars: a vector containing names of columns that contain grouping variables
##   na.rm: a boolean that indicates whether to ignore NA's
##   conf.interval: the percent range of the confidence interval (default is 95%)


summarySE <- function(data=NULL, measurevar, groupvars=NULL, na.rm=FALSE,
                      conf.interval=.95, .drop=TRUE) {
  require(plyr) …
Run Code Online (Sandbox Code Playgroud)

r graph bar-chart ggplot2

4
推荐指数
1
解决办法
6258
查看次数

R shiny ERROR:'closure'类型的对象不是子集

我使用以下代码,我总是得到这个子表函数错误.我的子集是什么,我错在哪里.这应该是我修改过的一些基本的入口代码,它在某些时候起作用,我看不到错误.

谢谢

server.R

library(shiny)

# Define a server for the Shiny app
shinyServer(function(input, output) {

  # Filter data based on selections
  output$table <- renderDataTable({
    data <- read.table("my.csv", sep =',', header =TRUE)
    if (input$shortdesc != "All"){
      data <- data[data$ShortDescription == input$shortdesc,]
    }
    if (input$taken != "All"){
      data <- data[data$Taken == input$taken,]
    }
    if (input$location != "All"){
      data <- data[data$Location == input$location,]
    }
    data
  })

})
Run Code Online (Sandbox Code Playgroud)

ui.R

library(shiny)
# Define the overall UI

shinyUI(
  fluidPage(
    titlePanel("My Items"),

    # Create a new Row …
Run Code Online (Sandbox Code Playgroud)

r shiny

3
推荐指数
1
解决办法
3万
查看次数

read.csv()和colClasses

我正在尝试使用read.csv()命令,但我不理解colClasses运行编码的部分.有没有人解释它是什么,还给我简单编码的例子read.csv()

另外,如果我运行我的编码read.csv(),我会收到错误

> object of type 'closure' is not subsettable
Run Code Online (Sandbox Code Playgroud)

这是什么类型的错误?上次我运行我的代码,它工作,但现在我得到了这个.我不确定我应该在这做什么改变.这是我的代码:

Precipfiles[1:24] <- list.files(pattern=".csv")
> DF <- NULL
> for (f in Precipfiles[1:24]) {
    data[1:24]<-read.csv(f,header=T,sep="\t",na.string="",colClasses="character")
    DF[1:24]<-rbind(DF,data[1:24])
}
Run Code Online (Sandbox Code Playgroud)

基本上,我加载所有数据并将它们放在一起,但merge()由于我遇到上面列出的麻烦,我无法使用命令.

我想我不应该使用colClasses="character"因为我使用的数据都是200乘200矩阵的数字.我必须将24个数据文件放在一起.

如果您有任何建议并建议改进此编码,请告诉我.谢谢你的帮助.

r read.csv

2
推荐指数
1
解决办法
1180
查看次数

标签 统计

r ×6

shiny ×2

bar-chart ×1

closures ×1

ggplot2 ×1

graph ×1

read.csv ×1

runtime-error ×1