typehint: Additional Type Information

Description Usage Arguments Details Examples

View source: R/typehints.R

Description

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.

Usage

 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

Arguments

x

an R object

Details

Since typehints are implemented as comments one can use the comment command directly to avoid copying.

Examples

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")

PythonInR documentation built on May 2, 2019, 5:17 p.m.