1

I am trying to run a Python function fitKCA within the R environment through the package reticulate.

The function is sourced correctly and all I do is to call the function:

fitKCA(z = bh$V1, q = 0.1)

and pass the two arguments:

  • bh$V1, a column (of type dbl) of a tibble
  • q, a scalar

Nevertheless, I get the following error message:

Error in py_call_impl(callable, dots$args, dots$keywords):AttributeError: 'list' object has no attribute 'shape'

In my understanding, the column of the tibble extracted through the $ sign is of the R type list and this clashes with the Python numpy library and hence has no shape attribute.

So my questions are:

  1. how can I avoid this error?

  2. How do R objects match Python objects (i.e. if I use the $ sign is it compatible with numpy or pandas? Or what if I use instead bh[,2] or bh[,"V1"], is there any difference?)?

Many thanks and forgive my evident lack of computer science background.

Vitomir
  • 295
  • 2
  • 14

1 Answers1

0

I guess you can try this:

fitKCA(z = as.matrix(bh$V1), q = 0.1)
japrin
  • 21
  • 2