Description Usage Arguments Details Examples
The function typehint
allows to set / get additional type information
in a structured way. Similar to as..*
(e.g. as.list
)
PythonInR provides th..*
(e.g. th.list
) functions to
control the type conversion done by PythonInR.
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 61 62 63 | th.int(x)
th.long(x)
th.float(x)
th.string(x)
th.unicode(x)
th.vector(x)
th.vector_int(x)
th.vector_str(x)
th.list(x)
th.list_int(x)
th.list_str(x)
th.tuple(x)
th.tuple_int(x)
th.tuple_str(x)
th.ttuple(x)
th.ttuple_int(x)
th.ttuple_str(x)
th.tlist(x)
th.tlist_str(x)
th.tlist_int(x)
th.numpy(x)
th.numpy_int(x)
th.numpy_str(x)
th.scibsr(x)
th.scicoo(x)
th.scicsc(x)
th.scicsr(x)
th.scidia(x)
th.scidok(x)
th.scilil(x)
th.cvxopt(x)
th.pandas(x)
|
x |
an R object |
Since typehints are implemented as comments one can use the comment command directly to avoid copying.
1 2 3 4 5 6 7 8 9 | pySet("vec", 1:3) ## v will be assigned as PythonInR.vector
pyType("vec")
## li will be assigned as list, where the elements are of type long
pySet("li", th.list(1:3))
pyType("li")
pySet("li_int", th.list_int(1:3))
pyType("li_int")
pySet("x", th.tuple(list(1, 2))) ## x will be assigned as tuple
pyType("x")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.