Options

subsetting in execute R process

jujujuju Member Posts: 39 Guru
edited November 2018 in Help

Hi, some basic subsetting of data frame seems to be not working when executing R in Rapidminer.

I ran this R code in Rstudio and it yields correct dimension after subsetting:

cat('dimension of training x:', dim(as.data.frame(dat[train, x])), '\n')
cat('dimension of training y:', dim(as.data.frame(dat[train, y])), '\n')
# dimension of training x: 138 60
# dimension of training y: 138 1

And then I paste this R code into a execute R process in Rapidminer, and it yields:

Jul 7, 2016 4:57:43 PM INFO: dimension of training x: 62 1 

Jul 7, 2016 4:57:43 PM INFO: dimension of training y: 62 1

I print many other things to debug, and other things are all same in two cases (Rstudio vs Rapidminer). -- See complete output below

Sonar data (208 rows * 61 columns) is used in both cases.

 

--------

 

Complete R code:

 

 

library(mlbench)

rm_main = function(dat, in_rapidminer = T){

cat('Starting R script now ...\n')


# find columns of x (attribute) and y (response) ####
if(in_rapidminer){
meta = melt(metaData)
meta$L1 = NULL
names(meta) = c('value', 'variable', 'column')

meta = dcast(meta, formula = column ~ variable)
print(meta)

y_name = meta[meta$role %in% 'label', 'column']
x_name = meta[meta$role %in% 'attribute', 'column']

y = names(dat) %in% y_name
x = names(dat) %in% x_name
} else {
# in R manually specify it:
y_name = 'Class'
y = names(dat) %in% y_name
x = ! names(dat) %in% c(y_name, 'pred_prob', 'pred')
}

cat('y column:', which(y), '\n')
cat('x column(s):', which(x), '\n')

cat('dimension of data:', dim(dat), '\n')


# encode y (only work for binary) ####
f1 = paste0('~', y_name, '- 1')
dat[[y_name]] = model.matrix(as.formula(f1), data = dat)[ , 1]


# ####
n_row = nrow(dat)
n_fold = 3

set.seed(123)

group = (seq_len(n_row) - 1) %% n_fold + 1
group = sample(group) # random permutation
print(table(group))

# n_fold CV ####
for(ii in seq_len(n_fold)){

cat('CV round', ii, '\n')
train = group != ii
cat('dimension of data:', dim(dat), '\n')
cat('how many rows in training set:', sum(train), '\n')

cat('dimension of training x:', dim(as.data.frame(dat[train, x])), '\n')
cat('dimension of training y:', dim(as.data.frame(dat[train, y])), '\n')

}

return(1)
}


data(Sonar)
dat = Sonar

rm_main(dat, in_rapidminer = F)

Complete output:

 

Starting R script now ...
y column: 61
x column(s): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
dimension of data: 208 61
group
1 2 3
70 69 69
CV round 1
dimension of data: 208 61
how many rows in training set: 138
dimension of training x: 138 60
dimension of training y: 138 1
CV round 2
dimension of data: 208 61
how many rows in training set: 139
dimension of training x: 139 60
dimension of training y: 139 1
CV round 3
dimension of data: 208 61
how many rows in training set: 139
dimension of training x: 139 60
dimension of training y: 139 1

(Highlight in red by me)

 

 

 

Complete Rapidminer code:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.4.000">
<context>
<input>
<location>//_your_path_/Sonar</location>
</input>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.4.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="multiply" compatibility="6.4.000" expanded="true" height="94" name="Multiply" width="90" x="112" y="120"/>
<operator activated="true" class="r_scripting:execute_r" compatibility="6.4.000" expanded="true" height="76" name="CV" width="90" x="313" y="165">
<parameter key="script" value="rm_main = function(dat, in_rapidminer = T){&#10; &#10; cat('Starting R script now ...\n')&#10; &#10;&#10; # find columns of x (attribute) and y (response) ####&#10; if(in_rapidminer){&#10; meta = melt(metaData)&#10; meta$L1 = NULL&#10; names(meta) = c('value', 'variable', 'column')&#10; &#10; meta = dcast(meta, formula = column ~ variable)&#10; print(meta)&#10; &#10; y_name = meta[meta$role %in% 'label', 'column']&#10; x_name = meta[meta$role %in% 'attribute', 'column']&#10; &#10; y = names(dat) %in% y_name&#10; x = names(dat) %in% x_name&#10; } else {&#10; # in R manually specify it:&#10; y_name = 'Class'&#10; y = names(dat) %in% y_name&#10; x = ! names(dat) %in% c(y_name, 'pred_prob', 'pred')&#10; }&#10; &#10; cat('y column:', which(y), '\n')&#10; cat('x column(s):', which(x), '\n')&#10; &#10; cat('dimension of data:', dim(dat), '\n')&#10; &#10; &#10; # encode y (only work for binary) ####&#10; f1 = paste0('~', y_name, '- 1')&#10; dat[[y_name]] = model.matrix(as.formula(f1), data = dat)[ , 1]&#10; &#10; &#10; # ####&#10; n_row = nrow(dat)&#10; n_fold = 3&#10; &#10; set.seed(123)&#10; &#10; group = (seq_len(n_row) - 1) %% n_fold + 1&#10; group = sample(group) # random permutation&#10; print(table(group))&#10; &#10; # n_fold CV ####&#10; for(ii in seq_len(n_fold)){&#10; &#10; cat('CV round', ii, '\n')&#10; train = group != ii&#10; cat('dimension of data:', dim(dat), '\n')&#10; cat('how many rows in training set:', sum(train), '\n')&#10; &#10; cat('dimension of training x:', dim(as.data.frame(dat[train, x])), '\n')&#10; cat('dimension of training y:', dim(as.data.frame(dat[train, y])), '\n')&#10;&#10; }&#10; &#10; return(1)&#10;}"/>
</operator>
<connect from_port="input 1" to_op="Multiply" to_port="input"/>
<connect from_op="Multiply" from_port="output 1" to_port="result 1"/>
<connect from_op="Multiply" from_port="output 2" to_op="CV" to_port="input 1"/>
<connect from_op="CV" from_port="output 1" to_port="result 2"/>
<portSpacing port="source_input 1" spacing="90"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
<description align="center" color="yellow" colored="false" height="58" resized="true" width="214" x="250" y="243">This R code works with binary (two-class) response only</description>
</process>
</operator>
</process>

Complete log in Rapidminer:

Jul 7, 2016 5:15:25 PM INFO: Starting R script now ...

Jul 7, 2016 5:15:25 PM INFO: column role type

Jul 7, 2016 5:15:25 PM INFO: 1 attribute_1 attribute real

Jul 7, 2016 5:15:25 PM INFO: 2 attribute_10 attribute real

Jul 7, 2016 5:15:25 PM INFO: 3 attribute_11 attribute real

<I omit some lines here for clarity>

Jul 7, 2016 5:15:25 PM INFO: 58 attribute_7 attribute real

Jul 7, 2016 5:15:25 PM INFO: 59 attribute_8 attribute real

Jul 7, 2016 5:15:25 PM INFO: 60 attribute_9 attribute real

Jul 7, 2016 5:15:25 PM INFO: 61 class label nominal

Jul 7, 2016 5:15:25 PM INFO: y column: 61

Jul 7, 2016 5:15:25 PM INFO: x column(s): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

Jul 7, 2016 5:15:25 PM INFO: dimension of data: 208 61

Jul 7, 2016 5:15:25 PM INFO: group

Jul 7, 2016 5:15:25 PM INFO: 1 2 3

Jul 7, 2016 5:15:25 PM INFO: 70 69 69

Jul 7, 2016 5:15:25 PM INFO: CV round 1

Jul 7, 2016 5:15:25 PM INFO: dimension of data: 208 61

Jul 7, 2016 5:15:25 PM INFO: how many rows in training set: 138

Jul 7, 2016 5:15:25 PM INFO: dimension of training x: 61 1

Jul 7, 2016 5:15:25 PM INFO: dimension of training y: 61 1


Jul 7, 2016 5:15:25 PM INFO: CV round 2

Jul 7, 2016 5:15:25 PM INFO: dimension of data: 208 61

Jul 7, 2016 5:15:25 PM INFO: how many rows in training set: 139

Jul 7, 2016 5:15:25 PM INFO: dimension of training x: 61 1

Jul 7, 2016 5:15:25 PM INFO: dimension of training y: 61 1


Jul 7, 2016 5:15:25 PM INFO: CV round 3

Jul 7, 2016 5:15:25 PM INFO: dimension of data: 208 61

Jul 7, 2016 5:15:25 PM INFO: how many rows in training set: 139

Jul 7, 2016 5:15:25 PM INFO: dimension of training x: 61 1

Jul 7, 2016 5:15:25 PM INFO: dimension of training y: 61 1


Jul 7, 2016 5:15:25 PM INFO: Saving results.

Jul 7, 2016 5:15:25 PM INFO: Process

Any help's appreciated. Thanks-

Tagged:

Best Answer

  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Solution Accepted

    If you add a line like this near the beginning of the code, it seems to fix the issue.

     

    dat <- as.data.frame(dat)

    It's something to do with the type of the dat variable. In pure R, it's a data.frame. In RapidMiner it's also a data.table

     

    Andrew

Answers

  • Options
    jujujuju Member Posts: 39 Guru

    <I deleted this reply>

  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn

    Hello

     

    What is the variable metaData in the R script. If you do str(metaData) what do you get?

     

    regards

     

    Andrew

  • Options
    jujujuju Member Posts: 39 Guru

    Thanks Andrew. metaData is a list of list of list.

    (In case you're not familiar with metaData, it's information about the role (label/id/attribute/...) and the datatype of each column. For example, you can use `set role` operator in Rapidminer to control the role, and you can control the role in import data wizard.)

    The official doc of `execute R` operator talks about handling metadata <http://docs.rapidminer.com/studio/operators/utility/scripting/execute_r.html>

    if you go to the HELP of `execute R` in Rapidminer, there're links to the examples in the doc.

    Jul 7, 2016 10:39:36 PM INFO: List of 1

    Jul 7, 2016 10:39:36 PM INFO: $ dat:List of 61

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_1 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_2 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_3 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_4 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_5 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_6 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_7 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_8 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_9 :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_10:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_11:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_12:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_13:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_14:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_15:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_16:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_17:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_18:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_19:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_20:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_21:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_22:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_23:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_24:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_25:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_26:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_27:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_28:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_29:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_30:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_31:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_32:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_33:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_34:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_35:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_36:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_37:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_38:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_39:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_40:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_41:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_42:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_43:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_44:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_45:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_46:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_47:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_48:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_49:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_50:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_51:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_52:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_53:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_54:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_55:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_56:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_57:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_58:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_59:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ attribute_60:List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "real"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "attribute"

    Jul 7, 2016 10:39:36 PM INFO: ..$ class :List of 2

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ type: chr "nominal"

    Jul 7, 2016 10:39:36 PM INFO: .. ..$ role: chr "label"

    Jul 7, 2016 10:39:36 PM INFO: NULL

    It's easier to see after flattening and reorganization:

    Jul 7, 2016 10:39:36 PM INFO: meta data reorganized:

    Jul 7, 2016 10:39:36 PM INFO: column role type

    Jul 7, 2016 10:39:36 PM INFO: 1 attribute_1 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 2 attribute_10 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 3 attribute_11 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 4 attribute_12 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 5 attribute_13 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 6 attribute_14 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 7 attribute_15 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 8 attribute_16 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 9 attribute_17 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 10 attribute_18 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 11 attribute_19 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 12 attribute_2 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 13 attribute_20 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 14 attribute_21 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 15 attribute_22 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 16 attribute_23 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 17 attribute_24 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 18 attribute_25 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 19 attribute_26 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 20 attribute_27 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 21 attribute_28 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 22 attribute_29 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 23 attribute_3 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 24 attribute_30 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 25 attribute_31 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 26 attribute_32 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 27 attribute_33 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 28 attribute_34 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 29 attribute_35 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 30 attribute_36 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 31 attribute_37 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 32 attribute_38 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 33 attribute_39 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 34 attribute_4 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 35 attribute_40 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 36 attribute_41 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 37 attribute_42 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 38 attribute_43 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 39 attribute_44 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 40 attribute_45 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 41 attribute_46 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 42 attribute_47 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 43 attribute_48 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 44 attribute_49 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 45 attribute_5 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 46 attribute_50 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 47 attribute_51 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 48 attribute_52 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 49 attribute_53 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 50 attribute_54 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 51 attribute_55 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 52 attribute_56 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 53 attribute_57 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 54 attribute_58 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 55 attribute_59 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 56 attribute_6 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 57 attribute_60 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 58 attribute_7 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 59 attribute_8 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 60 attribute_9 attribute real

    Jul 7, 2016 10:39:36 PM INFO: 61 class label nominal

     

  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn

    Hello

     

    I know what roles are but I wasn't aware of the specific addition of an R variable that describes it.

     

    Andrew

  • Options
    jujujuju Member Posts: 39 Guru

    Hi Andrew,

    You solution fixed the problem. And I reproduced the mistake by doing dat = data.table(dat) in Rstudio.

     

    Thank you so much!

  • Options
    bhupendra_patilbhupendra_patil Administrator, Employee, Member Posts: 168 RM Data Scientist

    just commenting for future users to be aware of 

     

    Rapidminer Execute operator uses the data.table object vs data.frame

     

    so in the function rm_main(data1,data2,data3) all of data1,data2,data3 objects are datatables and not dataframes.

    So your best bet is converting the table to frame if you are more comfortable with dataframes

Sign In or Register to comment.