@@ -37,7 +37,7 @@ <H1><a name="R">34 SWIG and R</a></H1>
37
37
The R bindings are under active development. They have been used to
38
38
compile and run an R interface to QuantLib running on Mandriva Linux
39
39
with gcc. They are also used to create the SimpleITK R package, which
40
- runs on various linuxes and mac. Swig is used to create all wrapper
40
+ runs on Linux and MacOS. SWIG is used to create all wrapper
41
41
interfaces
42
42
to < a href ="http://http://www.simpleitk.org/ "> SimpleITK</ a > . The R
43
43
bindings also work on Microsoft Windows using Visual C++.
@@ -211,26 +211,30 @@ <H2><a name="R_nn6">34.6 C++ classes</a></H2>
211
211
The R interface has the following capabilities:
212
212
< ul >
213
213
< li > Destructor methods are registered and called automatically by the R garbage collector.
214
- < li > A range of std::vector types are converted automatically to R equivalents.
214
+ < li > A range of std::vector types are converted automatically to R equivalents via the std_vector.i library .
215
215
< li > The $ operator is used for method access.
216
- < li > Variable accessors are automatically generated and called via the $, [, [[, $<-, [<-, [[<- operators
216
+ < li > Variable accessors are automatically generated and called via the $, [, [[, $<-, [<-, [[<- operators.
217
217
</ ul >
218
218
</ p >
219
219
220
220
< H3 > < a name ="R_class_examples "> 34.6.1 Examples</ a > </ H3 >
221
221
222
222
223
+ < p >
223
224
Consider the following simple example:
225
+ </ p >
224
226
225
227
< div class ="code ">
226
228
< pre >
227
229
class Vehicle {
228
230
private:
229
231
int m_axles;
232
+
230
233
public:
231
234
int Axles() {
232
235
return(m_axles);
233
236
}
237
+
234
238
bool Available;
235
239
236
240
Vehicle() {
@@ -246,12 +250,14 @@ <H3><a name="R_class_examples">34.6.1 Examples</a></H3>
246
250
</ pre >
247
251
</ div >
248
252
253
+ < p >
249
254
The following options are available in R:
255
+ </ p >
250
256
251
257
< div class ="code ">
252
- < pre >
253
- v1 <- Vehicle()
254
- v2 <- Vehicle(4)
258
+ < pre >
259
+ v1 < - Vehicle()
260
+ v2 < - Vehicle(4)
255
261
# access members
256
262
v1$Axles()
257
263
[1] 2
@@ -260,7 +266,7 @@ <H3><a name="R_class_examples">34.6.1 Examples</a></H3>
260
266
v1$Available
261
267
[1] FALSE
262
268
# Set availabilty
263
- v1$Available <- TRUE
269
+ v1$Available < - TRUE
264
270
v1$Available
265
271
[1] TRUE
266
272
</ pre >
@@ -302,7 +308,7 @@ <H3><a name="R_class_examples">34.6.1 Examples</a></H3>
302
308
</ pre >
303
309
</ div >
304
310
< p >
305
- The names in the accessorFuns list correspond to class methods while names in the vaccessors section
311
+ The names in the < tt > accessorFuns</ tt > list correspond to class methods while names in the < tt > vaccessors</ tt > section
306
312
correspond to variables that may be modified.
307
313
</ p >
308
314
< H2 > < a name ="R_nn7 "> 34.7 Enumerations</ a > </ H2 >
0 commit comments