hpcc dataset and R data frame mapping
hpcc dataset gets converted to data frames when passed in as parameter but, all columns in dataframes are as list. e.g. cyl becomes a list instead of vector producing the error
please help if I am missing something
System error: 0: Rembed: Rcpp error: invalid type (list) for variable 'cyl'
- Code: Select all
IMPORT R,ML;
mtcarsrec := RECORD
real8 mpg;
unsigned1 cyl;
real8 disp;
unsigned2 hp;
real8 drat;
real8 wt;
real8 qsec;
boolean vs;
boolean am;
unsigned1 gear;
unsigned1 carb;
END;
hpccmtcars:= dataset([{21.0,6,160.0,110,3.90,2.620,16.46,TRUE,FALSE,4,4}],mtcarsrec);
STRING run_r(dataset(RECORDOF(hpccmtcars)) ds):=EMBED(R)
rslt= function (ds)
{
my_modl = lm(cyl ~ ., data = ds)
coef(my_modl)
}
rawToChar(serialize(rslt(ds), NULL,ascii=TRUE),multiple = FALSE)
ENDEMBED;
run_r( hpccmtcars );
please help if I am missing something
- balajisampath
- Posts: 65
- Joined: Mon Jul 22, 2013 6:29 pm
Unfortunately I'm not really very familiar with R, and in particular the differences between lists and vectors and when you would want one rather than the other. Ideally the R embed plugin would have been written by an R expert (but we don't have one).
If someone can help me understand the differences and why a vector is what is wanted in this situation, I can take a look at changing it (though I'll also have to be a little careful that I don't break any existing code).
If someone can help me understand the differences and why a vector is what is wanted in this situation, I can take a look at changing it (though I'll also have to be a little careful that I don't break any existing code).
- richardkchapman
- Community Advisory Board Member
- Posts: 110
- Joined: Fri Jun 17, 2011 8:59 am
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest