Error in xj[i] : invalid subscript type 'list'

前端 未结 3 662
暖寄归人
暖寄归人 2020-12-18 07:38

I tried to split the data(bank) into training data and test data. But I somehow got an error below.How can I solve this problem?

train = bank[1:100, ]
test =         


        
3条回答
  •  隐瞒了意图╮
    2020-12-18 08:23

    If you set the training data like:

    data[1: 100,]
    

    Then in lm() function you use the argument:

    data = bank[train,]
    

    Alternatively you can set train like:

    seq(1: 100)
    

    as a sequence of indices, you need to use in the

    lm(): data = bank, subset = train
    

提交回复
热议问题