Reputation: 15
I am working with SPSS Modeler and have Essentials for R installed.
I am trying to get a very simple test case to work, where I send data into an R Transform node and overwrite the data with data created in R.
In the sample below I use the Iris dataset (natively available in R), and try to return that data to the Modeler stream by overwriting the modelerData variable, and then adding the needed meta data to modelerDataModel:
data = iris[-5]
modelerData = data
modelerDataModel <- c(fieldName="Sepal Length", fieldLabel="",fieldStorage="real", fieldMeasure="", fieldFormat="", fieldRole="")
cnm = c(fieldName="Sepal Width", fieldLabel="",fieldStorage="real", fieldMeasure="", fieldFormat="", fieldRole="")
modelerDataModel <- cbind(modelerDataModel, cnm)
cnm = c(fieldName="Petal Lenth", fieldLabel="",fieldStorage="real", fieldMeasure="", fieldFormat="", fieldRole="")
modelerDataModel <- cbind(modelerDataModel, cnm)
cnm = c(fieldName="Petal Width", fieldLabel="",fieldStorage="real", fieldMeasure="", fieldFormat="", fieldRole="")
modelerDataModel <- cbind(modelerDataModel, cnm)
When running the Modeler Stream I get the following error message;
[2017-03-09 12:17:44] Cannot get data model: Invalid R CF Component Data Model format in R object "modelerDataModel".
This error message seems completely unhelpful, as I cannot seem to find any explanation of what is meant by "Invalid R CF Component" anywhere online. Do anyone know what's going wrong?
EDIT: Here's a quick sample of what the Iris date looks like in case anyone were wondering:
> iris[-5]
Sepal.Length Sepal.Width Petal.Length Petal.Width
1 5.1 3.5 1.4 0.2
2 4.9 3.0 1.4 0.2
3 4.7 3.2 1.3 0.2
4 4.6 3.1 1.5 0.2
5 5.0 3.6 1.4 0.2
6 5.4 3.9 1.7 0.4
7 4.6 3.4 1.4 0.3
8 5.0 3.4 1.5 0.2
9 4.4 2.9 1.4 0.2
10 4.9 3.1 1.5 0.1
Upvotes: 1
Views: 775
Reputation: 43
data(iris)
modelerData <- data.frame(iris)
m1 <- c(fieldName="Sepal.Length",fieldLabel="",fieldStorage="real",fieldMeasure="",fieldFormat="",fieldRole="");
m2 <- c(fieldName="Sepal.Width",fieldLabel="",fieldStorage="real",fieldMeasure="",fieldFormat="",fieldRole="");
m3 <- c(fieldName="Petal.Length",fieldLabel="",fieldStorage="real",fieldMeasure="",fieldFormat="",fieldRole="");
m4 <- c(fieldName="Petal.Width",fieldLabel="",fieldStorage="real",fieldMeasure="",fieldFormat="",fieldRole="");
m5 <- c(fieldName="Species",fieldLabel="",fieldStorage="string",fieldMeasure="",fieldFormat="",fieldRole="");
modelerDataModel <- data.frame(cbind(m1,m2,m3,m4,m5))
Here an example for the iris data set. You can remove the Species.
modelerData and modelerDataModel have to be dataframes.
Upvotes: 0
Reputation: 21
I found your question while searching for the same error. To solve this error, apply the function data.frame() to modelerData and modelerDataModel before the end of the script.
Upvotes: 2