[kepler-dev] [Bug 3909] - RExpression fails with certain port names

bugzilla-daemon at ecoinformatics.org bugzilla-daemon at ecoinformatics.org
Tue Mar 31 10:16:26 PDT 2009


http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3909





------- Comment #2 from soong at nceas.ucsb.edu  2009-03-31 10:16 -------
Here are three examples that should cover most bases.  The first one shows off
backticks for quoting otherwise invalid object names.  Off the top of my head,
I think it's safe to use backticks pretty much everywhere.  The second shows
how to use the assign and get operators, which is slightly more robust and can
handle names with backticks in them.  The third shows a limitation with assign
and get, which is that you need to use a temporary variable to make changes
with functions like names and dim.  I used a local wrapper to keep the global
environment tidy.  From what I've seen, weird names can get passed into the
RExpression actor through the port name (try an input port that's just a
number) or through a record (e.g., EML 2 Dataset passes a record with %).

Backticks and check.names = FALSE are probably easier to implement and will
cover the vast majority of edge cases.

`1 weird name` <- data.frame(`+` = 1, `-` = 2, check.names = FALSE)
`1 weird name`

assign("` name", data.frame(`*` = 3, `/` = 4, check.names = FALSE))
get("` name")

assign("` name", local({
  tmp <- get("` name")
  names(tmp) <- c("`", "\"")
  tmp}))
get("` name")


More information about the Kepler-dev mailing list