Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
calculate_r_expression [2026/07/22 18:13] hermann |
calculate_r_expression [2026/08/18 02:29] (current) hermann |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ^ Name ^ Type ^ Description ^ | ^ Name ^ Type ^ Description ^ | ||
| - | | Expression | [[ego_script#constants|Code]] | The expression that will run on R. ''Code'' values cannot be written as plain text constants in EGO Script — see [[#writing_the_expression_in_ego_script|Writing the expression in EGO Script]] below. | | + | | Expression | [[code_type|Code]] | The expression that will run on R. Written directly as a Code constant using its own raw string syntax — see [[#writing_the_expression_in_ego_script|Writing the expression in EGO Script]] below. | |
| | Treat Warning As Errors | [[Boolean Value Type]] | Warnings raised by the R script will be treated as errors. | | | Treat Warning As Errors | [[Boolean Value Type]] | Warnings raised by the R script will be treated as errors. | | ||
| Line 171: | Line 171: | ||
| ==== Writing the expression in EGO Script ==== | ==== Writing the expression in EGO Script ==== | ||
| - | Like [[calculate_python_expression|Calculate Python Expression]], the ''Expression'' input is type [[ego_script#constants|Code]], which is represented in the underlying script using base64 encoding — impractical to write or edit directly as a text constant. Instead, connect a ''String'' carrier functor containing the R expression text to the ''Expression'' port; its output is accepted wherever a ''Code'' value is expected. Since only this one output is needed, the carrier can be [[ego_script#inline_syntax|inlined]] directly into the call. | + | Like [[calculate_python_expression|Calculate Python Expression]], the ''Expression'' input is type [[code_type|Code]]. It can be filled in directly as a text constant, using Code Type's own raw string syntax — the same ''$"<delimiter>( raw_characters )<delimiter>"'' form used by String constants. This is also the form the Dinamica EGO GUI's dedicated code editor generates when it writes the ''Expression'' port's value, so a hand-written script and one produced by the GUI take the same shape. See [[code_type|Code Type]] for the full grammar, including the base64 alternative form. |
| - | + | ||
| - | This limitation is specific to hand-written EGO Script. In the Dinamica EGO GUI, the ''Expression'' port has a dedicated code editor that edits the ''Code'' value directly — the ''String'' carrier workaround is only necessary when writing or editing the ''.ego'' file as text. | + | |
| <code> | <code> | ||
| - | result := CalculateRExpression (String $"( | + | result := CalculateRExpression $"( |
| aboveThreshold <- t1$Value >= v1; | aboveThreshold <- t1$Value >= v1; | ||
| outputLookupTable("filteredPatches", t1$Key[aboveThreshold], t1$Value[aboveThreshold]); | outputLookupTable("filteredPatches", t1$Key[aboveThreshold], t1$Value[aboveThreshold]); | ||
| - | )") .no {{ | + | )" .no {{ |
| NumberTable landCoverAreas 1; | NumberTable landCoverAreas 1; | ||
| NumberValue minimumArea 1; | NumberValue minimumArea 1; | ||
| Line 193: | Line 191: | ||
| CalculateRExpression | CalculateRExpression | ||
| + | |||