Tue Aug 16, 2022 1:18 am
Login Register Lost Password? Contact Us

Please Note: The HPCC Systems forums are moving to Stack Overflow. We invite you to post your questions on Stack Overflow utilizing the tag hpcc-ecl (https://stackoverflow.com/search?tab=newest&q=hpcc-ecl). This legacy forum will be active and monitored during our transition to Stack Overflow but will become read only beginning September 1, 2022.

hpcc dataset and R data frame mapping

Questions and comments related to the rHPCC integration plugin

Thu Nov 16, 2017 4:16 pm Change Time Zone

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
System error: 0: Rembed: Rcpp error: invalid type (list) for variable 'cyl'

Code: Select all
mtcarsrec := RECORD
  real8     mpg;
  unsigned1 cyl;
  real8     disp;
  unsigned2 hp;
  real8     drat;
  real8     wt;
  real8     qsec;
  boolean   vs;
  boolean   am;
  unsigned1 gear;
  unsigned1 carb;
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)
rawToChar(serialize(rslt(ds), NULL,ascii=TRUE),multiple = FALSE)
run_r( hpccmtcars );

please help if I am missing something
Posts: 65
Joined: Mon Jul 22, 2013 6:29 pm

Mon Jan 08, 2018 9:03 am Change Time Zone

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).
Community Advisory Board Member
Community Advisory Board Member
Posts: 110
Joined: Fri Jun 17, 2011 8:59 am

Return to R Plugin

Who is online

Users browsing this forum: No registered users and 1 guest