source: trunk/examples/lang/R/functions_examples.R @ 2780

Last change on this file since 2780 was 2780, checked in by dkearney, 11 years ago

adding function rp_utils_progress(percent,message) where percent should be an integer (but can be a double that will be coerced to an integer) between 0 and 100 representing the amount of the application that has completed, and message is a string giving information about the amount of progress complete.

File size: 1.3 KB
Line 
1require(Rappture)
2
3
4lib = rp_lib("driver.xml")
5lib
6
7ee = rp_lib_get_string(lib,"input.string(ee).current")
8is.character(ee)
9ee
10
11dd = rp_lib_get_double(lib,"input.number(temperature).current")
12is.real(dd)
13dd
14
15ii = rp_lib_get_integer(lib,"input.integer(ii).current")
16is.integer(ii)
17ii
18
19bb = rp_lib_get_boolean(lib,"input.boolean(bb).current")
20is.logical(bb)
21bb
22
23ff = rp_lib_get_file(lib,"input.string(ee).current","myoutfile")
24is.integer(ff)
25ff
26
27ps = rp_lib_put_string(lib,"output.string(ps).current","voodoo",TRUE)
28is.integer(ps)
29ps
30
31d = as.real(12.45)
32pd = rp_lib_put_double(lib,"output.number(ps).current",d,TRUE)
33is.integer(pd)
34pd
35
36pf = rp_lib_put_file(lib,"output.string(pf).current","myoutfile",FALSE,FALSE)
37is.integer(pf)
38pf
39
40result = rp_lib_result(lib)
41is.integer(result)
42result
43
44result = rp_units_convert_double("0C","F")
45is.real(result)
46result
47
48show = TRUE
49result = rp_units_convert_string("100mm","m",show)
50is.character(result)
51result
52
53show = FALSE
54result = rp_units_convert_string("100mm","m",show)
55is.character(result)
56result
57
58percent = as.integer(56)
59result = rp_utils_progress(percent,"almost done...")
60is.integer(result)
61result
62
63result = rp_utils_progress(76,"almost done...")
64is.integer(result)
65result
66
67result = rp_utils_progress(36.546,"almost done...")
68is.integer(result)
69result
Note: See TracBrowser for help on using the repository browser.