代码之家  ›  专栏  ›  技术社区  ›  cs0815

quantregForest x不包含数据

r
  •  0
  • cs0815  · 技术社区  · 6 年前

    运行此代码:

    library(datasets)
    library(quantregForest)
    
    Xtrain <- iris$Sepal.Length
    Ytrain <- iris$Petal.Width
    
    model <- quantregForest(
        x = Xtrain
        , y = Ytrain
    )
    

    但收到以下错误消息:

    Error in quantregForest(x = Xtrain, y = Ytrain) :  x contains no data
    

    有人能看看出什么事了吗?

    附言:

    不过,这是可行的:

    library(datasets)
    library(quantregForest)
    library(dplyr)
    
    Xtrain <- iris %>%
        select(
            Sepal.Length
            , Petal.Length
        )
    
    Ytrain <- iris$Petal.Width
    
    model <- quantregForest(
        x = Xtrain
        , y = Ytrain
    )
    
    0 回复  |  直到 6 年前