renjin and dplyr's mutate

Skip to first unread message

Jan 21, 2019, 3:39:27 AM1/21/19
to Renjin

trying to using Renjin (version 0.9.2719) with dplyr packages (version 0.7.4 because the later 0.7.8 is not available due to rlang 0.3.1 dependency missing)

Trying to run this code:
  x <- '2015-05-05'
  df <- data.frame(x)
  names(df) <- c('date')
  val <- df %>% 
mutate(asDate = as.Date(date))

But always get this exception:
Caused by: java.lang.UnsupportedOperationException: DATAPTR on type org.renjin.sexp.StringArrayVector
at org.renjin.gnur.api.Rinternals.DATAPTR( ~[renjin-gnur-runtime-0.9.2719.jar:na]
at org.renjin.cran.dplyr.select__._Z7dataptrP7SEXPREC(select.cpp:216) ~[dplyr-0.7.4-b73.jar:na]
at org.renjin.cran.dplyr.select__._ZN4Rcpp5sugar9IndexHashILi16EEC2EP7SEXPREC(select.cpp:56) ~[dplyr-0.7.4-b73.jar:na]
at org.renjin.cran.dplyr.mutate__._ZN4Rcpp10duplicatedILi16ELb1ENS_6VectorILi16ENS_15PreserveStorageEEEEENS1_ILi10ES2_EERKNS_10VectorBaseIXT_EXT0_ET1_EE(mutate.cpp:30) ~[dplyr-0.7.4-b73.jar:na]
at org.renjin.cran.dplyr.mutate__._ZN5dplyr20check_valid_colnamesERKN4Rcpp14DataFrame_ImplINS0_15PreserveStorageEEE(mutate.cpp:19) ~[dplyr-0.7.4-b73.jar:na]
at org.renjin.cran.dplyr.mutate__._Z11mutate_implN4Rcpp14DataFrame_ImplINS_15PreserveStorageEEEN5dplyr11QuosureListE(mutate.cpp:204) ~[dplyr-0.7.4-b73.jar:na]
at org.renjin.cran.dplyr.RcppExports__._dplyr_mutate_impl(RcppExports.cpp:458) ~[dplyr-0.7.4-b73.jar:na]
at org.renjin.primitives.Native.redotCall( ~[renjin-core-0.9.2719.jar:na]
... 228 common frames omitted

The exception is risen in in this method:
public static Object DATAPTR(SEXP x) {
  if (x instanceof IntVector || x instanceof LogicalVector) {
    return INTEGER(x);
  } else if(x instanceof DoubleVector) {
    return REAL(x);
  } else if(x instanceof ComplexVector) {
    return COMPLEX(x);
  } else if(x instanceof RawVector) {
    return RAW(x);
  } else {
    throw new UnsupportedOperationException("DATAPTR on type " + x.getClass().getName());

x variables is filled by name of column (in this case 'date') and column names are StringArrayVector. But clearly there is no check for StringArrayVector. Is not implemented yet? Would dplyr version 0.7.8 helps?

Does anybody know?


Bertram, Alexander

Jan 21, 2019, 3:53:23 AM1/21/19
Hi David,
The DATAPTR() function is part of GNU R's internals for which we've provided an emulation layer. The number of exposed functions is huge, and most are not widely used by packages, so we've been filling them in as we go along.

I'm not sure if DATAPTR() is supposed to return a pointer to an array of pointers to null-terminated strings, or a pointer to an array of pointers to CHARSEXP pointers. I will try both and see which makes the example above work.


You received this message because you are subscribed to the Google Groups "Renjin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Alexander Bertram
Technical Director
BeDataDriven BV

Tel. Nederlands: +31(0)647205388
Skype: akbertram

Jan 21, 2019, 4:32:59 AM1/21/19
to Renjin
Hi Alex, 

thanks a lot. It seems to be critical for us for real use of Renjin.


Dne pondělí 21. ledna 2019 9:53:23 UTC+1 Alexander Bertram napsal(a):
Reply all
Reply to author
0 new messages