如何在机器学习模型中使用R脚本将列名添加到输入数据集

如何在机器学习模型中使用R脚本将列名添加到输入数据集,r,azure-machine-learning-studio,R,Azure Machine Learning Studio,我试图使用下面的R脚本将列名添加到输入数据集 dataset1 <- maml.mapInputPort(1)#class: data.frame # Sample operation cols <- c("age", "workclass", "fnlwgt", "education", "education-num", "marital-status", "occupation", "relationship", "

我试图使用下面的R脚本将列名添加到输入数据集

dataset1 <- maml.mapInputPort(1)#class: data.frame
# Sample operation
cols <- c("age",
    "workclass",
    "fnlwgt",
    "education",
    "education-num",
    "marital-status",
    "occupation",
    "relationship",
    "race",
    "sex",
    "capital-gain",
    "capital-loss",
    "hours-per-week",
    "native-country",
    "income")
 colnames(data.frame) <- cols
 data.set = dataset1;
 maml.mapOutputPort("data.set");
dataset1 <- maml.mapInputPort(1)#class: data.frame
# Sample operation
cols <- c("age",
"workclass",
"fnlwgt",
"education",
"education-num",
"marital-status",
"occupation",
"relationship",
"race",
"sex",
"capital-gain",
"capital-loss",
"hours-per-week",
"native-country",
"income")
colnames(dataset) <- cols
data.set = dataset1;
maml.mapOutputPort("data.set");

dataset1最后,我解决了我的问题,使用下面的R脚本将列名添加到输入数据集中

dataset1 <- maml.mapInputPort(1)#class: data.frame
# Sample operation
cols <- c("age",
    "workclass",
    "fnlwgt",
    "education",
    "education-num",
    "marital-status",
    "occupation",
    "relationship",
    "race",
    "sex",
    "capital-gain",
    "capital-loss",
    "hours-per-week",
    "native-country",
    "income")
 colnames(data.frame) <- cols
 data.set = dataset1;
 maml.mapOutputPort("data.set");
dataset1 <- maml.mapInputPort(1)#class: data.frame
# Sample operation
cols <- c("age",
"workclass",
"fnlwgt",
"education",
"education-num",
"marital-status",
"occupation",
"relationship",
"race",
"sex",
"capital-gain",
"capital-loss",
"hours-per-week",
"native-country",
"income")
colnames(dataset) <- cols
data.set = dataset1;
maml.mapOutputPort("data.set");

dataset1最后,我解决了我的问题,使用下面的R脚本将列名添加到输入数据集中

dataset1 <- maml.mapInputPort(1)#class: data.frame
# Sample operation
cols <- c("age",
    "workclass",
    "fnlwgt",
    "education",
    "education-num",
    "marital-status",
    "occupation",
    "relationship",
    "race",
    "sex",
    "capital-gain",
    "capital-loss",
    "hours-per-week",
    "native-country",
    "income")
 colnames(data.frame) <- cols
 data.set = dataset1;
 maml.mapOutputPort("data.set");
dataset1 <- maml.mapInputPort(1)#class: data.frame
# Sample operation
cols <- c("age",
"workclass",
"fnlwgt",
"education",
"education-num",
"marital-status",
"occupation",
"relationship",
"race",
"sex",
"capital-gain",
"capital-loss",
"hours-per-week",
"native-country",
"income")
colnames(dataset) <- cols
data.set = dataset1;
maml.mapOutputPort("data.set");

dataset1我想那一定是
dataset1
而不是
dataset

dataset1 <- maml.mapInputPort(1) #class: data.frame

# Sample operation

cols <- c("age",
    "workclass",
    "fnlwgt",
    "education",
    "education-num",
    "marital-status",
    "occupation",
    "relationship",
    "race",
    "sex",
    "capital-gain",
    "capital-loss",
    "hours-per-week",
    "native-country",
    "income")

colnames(dataset1) <- cols

maml.mapOutputPort("dataset1");

dataset1我想那一定是
dataset1
而不是
dataset

dataset1 <- maml.mapInputPort(1) #class: data.frame

# Sample operation

cols <- c("age",
    "workclass",
    "fnlwgt",
    "education",
    "education-num",
    "marital-status",
    "occupation",
    "relationship",
    "race",
    "sex",
    "capital-gain",
    "capital-loss",
    "hours-per-week",
    "native-country",
    "income")

colnames(dataset1) <- cols

maml.mapOutputPort("dataset1");
dataset1